<< 14-07-2019 >>

00:00:01*junland quit (Quit: %ZNC Disconnected%)
00:00:45*junland joined #nim
00:01:03*onionhammer1 is now known as onionhammer
00:17:05*stefanos82 quit (Quit: Quitting for now...)
00:23:41FromGitter<Obround> How do you print a seq as an array?
00:33:05*actuallybatman quit (Ping timeout: 268 seconds)
01:02:15*ng0_ joined #nim
01:04:03*ng0_ quit (Client Quit)
01:04:56*ng0 quit (Ping timeout: 260 seconds)
01:12:33rayman22201@Obround: http://ix.io/1OqI/nim
01:12:50rayman22201just remove the '@' from the string?
01:16:29*sniffdtek quit (Remote host closed the connection)
01:26:34skrylar[m]@zacharycarter yes there were some warnings around the net about that; ktx is well specified (dds is just sorta.. half-ass specified, but hasn't changed) but there were notes in the unity/crunch posts that ktx tools tend to be bugtastic
02:11:03FromDiscord_<jos> was the nimble file format changed recently hahaha
02:11:25FromDiscord_<jos> reading as ini failed, interpreting as nimscript failed
02:11:26FromDiscord_<jos> 😃
02:15:03*laaron- quit (Remote host closed the connection)
02:17:37FromDiscord_<jos> lol even the generated config made with nimble init is failing to parse
02:17:41FromGitter<Obround> <rayman22201> -- Thanks!
02:17:54FromDiscord_<jos> I just installed nimble from the arch repo
02:18:12FromGitter<Obround> How do you delete a variable?
02:19:20*laaron joined #nim
02:29:39rayman22201Set it to nil
02:46:08*laaron- joined #nim
02:46:22*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
03:18:21*lritter quit (Ping timeout: 268 seconds)
03:19:01*lritter joined #nim
03:22:54*dddddd quit (Remote host closed the connection)
03:50:10*laaron- quit (Quit: ZNC 1.7.1 - https://znc.in)
03:52:17*PMunch quit (Remote host closed the connection)
03:54:53*laaron joined #nim
03:57:06*laaron quit (Client Quit)
03:58:48*laaron joined #nim
04:00:36*laaron quit (Client Quit)
04:02:32*laaron joined #nim
04:03:29*laaron quit (Remote host closed the connection)
04:06:24*laaron joined #nim
04:10:38*laaron quit (Client Quit)
04:11:51*laaron joined #nim
04:13:03*laaron quit (Remote host closed the connection)
04:16:35*laaron joined #nim
04:32:05*sniffdtek joined #nim
05:11:12*lritter quit (Ping timeout: 268 seconds)
05:15:59*narimiran joined #nim
05:41:52*solitudesf joined #nim
05:48:26*MH026 quit (Remote host closed the connection)
05:59:58*absolutejam3 joined #nim
06:13:41leorize[m]@jos I'd recommend using choosenim on Arch
06:14:21leorize[m]iirc the maintainer hasn't updated nim to 0.20.0
06:16:08FromGitter<zacharycarter> skrylar[m] - I wouldn't be surprised if author of raylib just didn't write his load / save methods correctly
06:16:28FromGitter<zacharycarter> also - I added bc7 compression as a supported compression format to the dds loader you wrote
06:16:41FromGitter<zacharycarter> not sure if you want me to PR it or not
06:17:10FromDiscord_<Skaruts> ChooseNim vs Nimble?
06:17:52FromGitter<zacharycarter> I think he's saying to install nimble - use choosenim
06:18:00FromGitter<zacharycarter> not trying to say use choosenim over nimble - they are not 1:1
06:18:20FromDiscord_<Skaruts> yea I don't know the difference
06:18:54FromDiscord_<Skaruts> that's what I'm asking, sorry, I could've asked more clearly
06:18:57FromGitter<zacharycarter> Choosenim is like rustup - it allows you to manage different install versions of Nim
06:19:10FromGitter<zacharycarter> nimble is Nim's package manager
06:19:12rayman22201They are totally different. Choosenim installs the Nim compiler for you. Nimble is a package manager.
06:19:23FromDiscord_<Skaruts> oh
06:19:36FromGitter<zacharycarter> so with choosenim you can have like 5 different versions of Nim installed
06:19:42FromGitter<zacharycarter> and easily switch between which version you use
06:20:07FromGitter<zacharycarter> with Nimble - someone can develop a package and then you can reference that package in your nimble file, and use it as a dependency - just like with NPM in the JS world
06:20:16FromGitter<zacharycarter> except nimble doesn't suck nearly as hard as NPM does
06:20:27FromGitter<zacharycarter> nor does Nim suck nearly as hard as JS does :P
06:20:35rayman22201Zacharycarter you got this. Didn't mean to jump in on your toes lol
06:20:38FromDiscord_<Skaruts> hmmm, I can't remember how I installed nim before
06:21:01FromGitter<zacharycarter> hahaha no worries at all :) was just being thorough in my explanation I guess :P
06:21:18FromGitter<zacharycarter> in case Skaruts has never used rustup / a package manager before
06:21:27FromDiscord_<Skaruts> I did a bit
06:21:40FromDiscord_<Skaruts> I tried rust a bit a while ago
06:21:51FromGitter<zacharycarter> ah cool
06:21:56FromDiscord_<Skaruts> oh wait no, actually I used cargo
06:22:07FromDiscord_<Skaruts> but yea I get what you're saying
06:23:51FromGitter<zacharycarter> yeah cargo is rust's package manager
06:24:21FromGitter<zacharycarter> I went to be around 3 last night - my dog woke me up around 8:45 and was back in bed by 9
06:24:25FromGitter<zacharycarter> wtf
06:24:29FromGitter<zacharycarter> dog
06:26:49*Senketsu joined #nim
06:31:23FromGitter<eptification> @Skaruts dont forget to add to path
06:32:17FromDiscord_<Skaruts> yup
06:38:42*gangstacat quit (Quit: Ĝis!)
06:55:59*nsf joined #nim
07:00:00*gmpreussner quit (Quit: kthxbye)
07:02:41FromGitter<arnetheduck> @zacharycarter which features of `nimble` do you prefer over `npm` / what does `nimble` do better?
07:03:49FromGitter<zacharycarter> it might just be a scale factor - but npm has historically had several issues with packages breaking which screws up everyone downstream
07:04:10FromGitter<zacharycarter> also - I dislike how NPM allows you to store configuration inside your projects definition
07:04:39*gmpreussner joined #nim
07:04:43FromGitter<zacharycarter> dev dependencies vs dependencies suck
07:04:55*absolutejam3 quit (Ping timeout: 246 seconds)
07:05:21FromGitter<zacharycarter> I think my distaste for it is more of a distaste for the entire JS tooling ecosystem
07:08:43*Trustable joined #nim
07:09:39FromGitter<zacharycarter> it does have some nice features too - like the CI feature is pretty sweet
07:09:45FromGitter<zacharycarter> but I think nimble already does that out of the box
07:16:58*absolutejam3 joined #nim
07:22:51FromDiscord_<Skaruts> trying to figure out when `methods` are actually needed. According to Nim tutorial, they're needed for dynamic dispatch.
07:22:51FromDiscord_<Skaruts>
07:22:52FromDiscord_<Skaruts> How do I know when I require dynamic dispatch for my object? Inheritance seems to work fine with procs, as I've just tested.
07:23:10FromDiscord_<Skaruts> (simple inheritance at least)
07:24:22FromDiscord_<Skaruts> (I just forgot about not using multi-line messages on discord... sorry about that)
07:29:15*Senketsu quit (Quit: WeeChat 2.5)
07:29:35Zevvrayman22201: it's all complicated. getData() is used to access the data of type T that was passed when registering the fd, and is indexed by fd itself.
07:29:45ZevvSo the only way around is an unique fake fd for each event handler
07:29:47Zevvbah
07:40:58*gangstacat joined #nim
07:48:11FromGitter<mratsim> @Skaruts, if it's in the same module, and only that specific proc is visible to your inherited type only it can be called so it will work
07:48:24FromGitter<mratsim> but otherwise, it might become a mess
07:48:56*NiCad joined #nim
07:49:13*absolutejam3 quit (Ping timeout: 258 seconds)
07:53:00*Trustable quit (Remote host closed the connection)
07:55:01FromDiscord_<Skaruts> well in my test they're both in the same module, but all the procs are visible too
07:59:09FromDiscord_<Skaruts> https://play.nim-lang.org/#ix=1Os3
08:13:58*Senketsu joined #nim
08:17:50FromGitter<mratsim> try with the test in a different file
08:18:38FromGitter<mratsim> btw I opened the RFC on removing the `[]` dereference operator to replace it by `deref`: https://github.com/nim-lang/RFCs/issues/154
08:21:24FromGitter<mratsim> Woot: so we can implement a threading library in newruntime? https://github.com/nim-lang/Nim/commit/416ba133ad1e62cc8ce7241c85e89d5707b5736f
08:25:22*brakmic joined #nim
08:26:00*actuallybatman joined #nim
08:30:36*brakmic_ joined #nim
08:31:49*NiCad quit (Remote host closed the connection)
08:32:56FromGitter<alehander42> wow i decided to use `deref` in my hobby lang
08:33:14*brakmic quit (Ping timeout: 272 seconds)
08:33:31FromGitter<alehander42> but just because i cant think of a good letter
08:33:45FromGitter<alehander42> actually using it in a real lang sounds really verbose to me
08:34:09FromGitter<alehander42> (but is [] used often actually)
08:35:32FromGitter<mratsim> I do lots of lowlevel stuff and I'm mostly using addr/unsafeAddr
08:38:07FromGitter<mratsim> the only places I'm using `[]` is when when initializing/deallocating an object that contains a ref, for example: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/data_structure.nim#L58, https://github.com/mratsim/Arraymancer/blob/master/src/tensor/backend/cuda.nim#L30
08:38:12FromDiscord_<Skaruts> by `deref` you mean `deref(pointer)` ?
08:38:16FromGitter<mratsim> yes
08:38:31FromDiscord_<Skaruts> not a fan of that tbh
08:38:40FromDiscord_<Skaruts> not a fan of `[]` though
08:38:46FromDiscord_<Skaruts> either
08:39:26FromDiscord_<Skaruts> generally I'm not a fan of explicit function calls when symbols could be used
08:39:42FromDiscord_<Skaruts> shl, shr, div, mod, etc, not a fan of any of that...
08:39:49FromDiscord_<Skaruts> not as readable
08:41:07FromDiscord_<Skaruts> is it impossible for Nim to implement * for dereferencing?
08:43:18FromGitter<mratsim> Nim philosophy is to prefer names to symbol unless there is wide recognition. That leaves operators free for libraries.
08:44:26FromGitter<mratsim> you can do `proc `*`(x: ptr T or ref T): var T = x[]`
08:45:20FromDiscord_<Skaruts> well one could do that for `deref` as well I guess
08:46:04FromDiscord_<Skaruts> I would argue that there's wide recognition for `*` though
08:46:42FromGitter<mratsim> Or maybe this: ⏎ ⏎ `proc *(x: ptr T or ref T): var T {magic:"Deref"}` assuming that's the name of the compiler builtin
08:46:57FromGitter<mratsim> Only in the C/C++ community
08:47:12FromGitter<mratsim> Stuff like >> can mean very different thing in say Haskell
08:47:31FromDiscord_<Skaruts> yea but nearly everyone and their mothers has at least poked into C++ 😄
08:47:41FromDiscord_<Skaruts> or C
08:47:54FromDiscord_<Skaruts> anyway that's among my biggest peeves with Nim though, I prefer symbols to names because names blend in with the rest of the code, making it less discernible
08:48:00FromGitter<alehander42> i dont like `*` for deref
08:48:04FromGitter<mratsim> Many people in Python don't want to touch C++, it's "scary"
08:48:08FromGitter<alehander42> i dont understand why they use it
08:48:27FromGitter<alehander42> wait, it is `&`
08:48:36FromGitter<mratsim> I'm pretty sure it was to save bytes or use less space when code was on perforated stuff
08:48:37FromDiscord_<Skaruts> tbh I don't mind `[]` for being different, just for being two characters that in my keyboard require a mod key
08:48:39FromGitter<alehander42> no, exactly, you mean deref
08:48:53FromGitter<alehander42> its `a*` which just seems counterintuitive to me
08:49:12FromGitter<mratsim> it's unary so it should be preceding the variable
08:49:43FromGitter<alehander42> yeah
08:49:44FromGitter<mratsim> anyway C has contraints that code should fit in a couple of kB of memory at the time
08:49:48FromGitter<mratsim> had*
08:50:02FromGitter<alehander42> yeah, maybe its a good opeator
08:50:06FromDiscord_<Skaruts> @alehander42 my best guess is that `*` kinda looks like a point, so pointer...
08:50:14FromGitter<alehander42> i am not sure why i dislike it
08:50:31FromGitter<alehander42> no, i disliked the fact that e.g.
08:50:39FromGitter<alehander42> you could say that `addr` is *
08:50:47FromGitter<mratsim> addr is &
08:50:49FromGitter<alehander42> because `&a` also produced a `*`
08:50:55FromGitter<alehander42> so why isnt it `*a` in c
08:50:59FromGitter<alehander42> in this kind of sense
08:51:19FromGitter<alehander42> i am not sure why exactly dereferencing deserves it more compared to getting an address
08:51:21FromGitter<mratsim> I'm more annoyed by *(myObject.myRefField) = something()
08:51:40FromGitter<alehander42> this makes sense, how would you design it
08:51:54FromGitter<mratsim> but anyway, we shouldn't take valuable operator space with that
08:52:23FromGitter<mratsim> I think deref is fine and people can remap that to `*` in their own code
08:52:45FromDiscord_<Skaruts> can that be done with a template btw?
08:52:57FromGitter<mratsim> but `[]` is annoying me left and right when I'm always overloading `[]` in my libraries
08:53:06FromGitter<mratsim> yes you can do that with a template or macro
08:54:36FromGitter<mratsim> This is a nice read on Rust concurrency library: https://stjepang.github.io/2019/01/29/lock-free-rust-crossbeam-in-2019.html
08:55:10*Senketsu quit (Quit: WeeChat 2.5)
08:55:16FromDiscord_<Skaruts> `template * (x: ptr T or ref T): var T = x[]`?
08:55:24FromDiscord_<Skaruts> I just replaced proc
08:56:28FromGitter<mratsim> yes that should work as well
08:56:43FromGitter<mratsim> with a \[T\]
08:56:44FromDiscord_<Skaruts> nice
09:02:15FromDiscord_<Skaruts> but I'm wondering, using a symbol doesn't exactly "take operator space", since it can always be overloaded by any other part of any code for its specific needs
09:04:53FromDiscord_<Skaruts> with a [T] like this: `template * [T](x: ptr T or ref T): var T = x[]`?
09:08:22*actuallybatman quit (Ping timeout: 245 seconds)
09:16:16FromDiscord_<Skaruts> hmm, there's more to it than that though, something needs to be done about `foo[].bar` and `echo foo[]`, which that expression alone doesn't cover
09:16:47*MH026 joined #nim
09:16:57FromDiscord_<Skaruts> the latter as `echo foo*` gives me an indentation error in the next line
09:17:35FromDiscord_<Skaruts> but disregard this anyway, I'm fine with using `[]` for now, I was just curious about it
09:21:38*sammich quit (Ping timeout: 248 seconds)
09:22:50*sammich joined #nim
09:22:50*sammich quit (Changing host)
09:22:50*sammich joined #nim
09:25:10*crem quit (Ping timeout: 276 seconds)
09:26:50*crem joined #nim
09:39:39leorize[m]well anyone going for `foo^`? (pascal-style deref)
09:40:54leorize[m]it's easier to distinguish and doesn't have the problem of sharing precedence with `*`
09:51:39*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
09:54:23*laaron joined #nim
10:09:53*ng0 joined #nim
10:12:40*Senketsu joined #nim
10:13:00ZevvHm I hardly ever deref explicitly, I'm not bothered by the occasional []
10:13:12*stefanos82 joined #nim
10:16:33*Senketsu quit (Client Quit)
10:20:07*Perkol joined #nim
10:20:49*jjido joined #nim
10:28:48*Perkol quit (Remote host closed the connection)
10:36:27*shomodj joined #nim
10:42:00*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:42:41*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:42:47FromDiscord_<kodkuce> who is timotheecour
10:43:07FromDiscord_<kodkuce> i just now noticed he posted issue on my github 😃
10:44:55*shomodj joined #nim
10:47:34alexander92well, having an issue is great actually!
10:49:03*Senketsu joined #nim
10:50:17*jjido joined #nim
10:50:30*Senketsu quit (Client Quit)
10:50:39FromGitter<mratsim> the pascal deref would require postfix operator support
10:50:54FromGitter<mratsim> 1) is special cased for export marker, I don't tink deref is worth it
10:52:23leorize[m]personally I don't think there's a need for any deref ops other than `[]`
10:52:27alexander92i like the pascal one
10:52:28*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:53:27Zevvhow often do you actually *do* a deref explictly? objects are sugared for you, and scalars are seldom reffed. Mostly doing FFI I guess?
10:54:09*Senketsu joined #nim
10:54:35FromGitter<mratsim> I'm not asking for a new deref op, I'm asking for changing the deref op to "deref" instead of `[]`
10:57:00leorize[m]well `[]` works fine enough
10:57:37leorize[m]and it's not annoying to use when derefs are needed
10:59:00FromGitter<mratsim> My arguments are there: https://github.com/nim-lang/RFCs/issues/154 ⏎ ⏎ It's very annoying when building array libraries with varargs arguments
11:01:39*brakmic_ quit (Read error: Connection reset by peer)
11:01:44FromGitter<zacharycarter> @krux02 - do you think your AST pattern matching library could be extended to support NimScript's AST?
11:01:50*brakmic joined #nim
11:04:15*bozaloshtsh quit (Ping timeout: 250 seconds)
11:05:49FromGitter<mratsim> he is in vacation
11:11:55*Trustable joined #nim
11:13:00FromGitter<mratsim> So I was investigating a regression where my matrix multiplication lost 5.5x performance out of the blue (it was competitive with Intel and state-of-the-art implementation but in pure Nim with no assembly). Turns out the -d:danger flag is worth 5.5x perf.
11:18:48*PrimHelios_ quit (Quit: ZNC - https://znc.in)
11:19:06*PrimHelios joined #nim
11:20:06*pbb joined #nim
11:24:30dom96Nim used to use the pascal deref
11:24:45dom96it's better to keep it reserved for pow
11:25:02*sagax quit (Ping timeout: 258 seconds)
11:26:43alexander92i often forgot nim started with pas2nim
11:32:12*couven92 joined #nim
11:36:29*Senketsu quit (Quit: WeeChat 2.5)
11:46:18*Senketsu joined #nim
11:47:40pbbHi everyone, I recently started using nim and ran into an issue with calling closures from an asynchttpserver handler and the garbage collector
11:48:34pbbI have a reproducable example: https://termbin.com/jgco
11:48:45pbbcode is at https://git.pbb.lc/petabyteboy/smartied
11:50:01pbbFirst I throught using threadvars might solve the problem by making all my code gcsafe. Now the compiler doesn't warn me about my functions not being gcsafe anymore, but it still crashes.
11:51:16pbbI am seeing the same issue with procedures called from an asyncdispatch setTimer callback
11:51:25pbbI mean addTimer
11:53:11pbbThe crash happened from time to timer when the gc was running during the procedure call from the callback.
11:53:41pbbSo I added an explicit GC_fullCollect call and it crashes reliably
11:56:26*Senketsu quit (Quit: WeeChat 2.5)
12:01:53*dddddd joined #nim
12:02:21dom96pbb: you need to initialise your variables for each thread
12:02:28*Senketsu joined #nim
12:02:32dom96threadvar means your var is thread-local
12:02:42pbbI only have on thread
12:02:56pbband I have initialized the vars on the main thread in the respective modules using them
12:03:02dom96then it should be fine, there must be some other reason that `server.state` is nil
12:03:08dom96have you tried debugging that?
12:03:39pbbwhere do you see that server.state is nil?
12:04:08dom96SIGSEGV: Illegal storage access. (Attempt to read from nil?)
12:04:15dom96That usually means you're reading from nil
12:04:29dom96https://git.pbb.lc/petabyteboy/smartied/src/branch/master/src/backend_powermeter.nim#L19
12:04:32dom96Points to server.state
12:05:36pbbsorry it seems like I did not commit everything properly
12:06:07pbbgo there again
12:06:22pbbthe line contains GC_fullCollect()
12:06:45pbbwhen it's commented the code works as excepted most of the time but randomly crashes when the GC kicks in
12:10:05*absolutejam3 joined #nim
12:11:25pbb@dom96 it crashes in a gc function. When I compile with --gc:markAndSweep, I get this: https://termbin.com/m0zu
12:13:55*leorize quit (Quit: WeeChat 2.3)
12:14:06*Senketsu quit (Quit: WeeChat 2.5)
12:14:53dom96pbb, Interesting. Are you using 0.20.0?
12:15:06dom96oh I see the version in the paths
12:15:13pbbI'm using a nightly build
12:15:22pbbbecause it fixes another issue that prevented compilation
12:15:57pbb(https://github.com/nim-lang/Nim/issues/11523)
12:16:10*noonien joined #nim
12:16:25dom96Try compiling with -d:useSysAssert -d:useGcAssert
12:16:27noonienhello folks
12:16:40dom96and report this on the issue tracker
12:16:58dom96if you can, come up with a step-by-step reproduction of this
12:16:59noonienhow can I read an entire utf-8 file into memory, as seq[Rune]?
12:17:04dom96even if it involves cloning your project
12:18:01pbbyes I can come up with a reproduction example, I will include it in the report
12:18:10pbbusing the parameters you mentioned makes it crash even earlier
12:18:33pbbhttps://termbin.com/tg70
12:19:59noonienah, `readFile().toRunes()`, would have been nice to minimise allocations
12:28:27*leorize joined #nim
12:28:52dom96pbb, yeah, I think that should help Araq or someone else find the issue
12:32:05*Senketsu joined #nim
12:37:58*absolutejam3 quit (Ping timeout: 245 seconds)
12:47:10*Senketsu quit (Quit: WeeChat 2.5)
12:48:18Araq var data = [0u32]
12:48:18Araq mb.modbus_set_slave(cint(ad))
12:48:18Araq let status = mb.modbus_read_input_registers(cint(reg), 2, data.addr)
12:48:18Araq let res = modbus_get_float_dcba(data.addr)
12:48:30Araq^ passed ptr to stack location that escapes?
12:58:54*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:03:31pbblet me try to comment out all calls to the libmodbus functions
13:03:35*jjido joined #nim
13:05:49*Senketsu joined #nim
13:10:17*Senketsu quit (Client Quit)
13:10:41pbb@Araq: good point, I will have to change that, but it doesn't seem to be the cause for the crashes I am getting
13:11:34*Trustable quit (Remote host closed the connection)
13:12:30*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:12:54*Skaruts joined #nim
13:14:58FromGitter<mratsim> ugh modbus ...
13:17:48pbb:D
13:19:09*Senketsu joined #nim
13:25:30Skaruts@mratsim, that inheritance thing still works in two files
13:25:46FromGitter<mratsim> oh, interesting
13:25:58SkarutsI also instantiated the second derived type to be sure
13:26:16SkarutsI wonder if it works with a deeper inheritance tree
13:26:17FromGitter<mratsim> my experience is that it breaks at some point but maybe it was because I used generics type
13:30:12Skarutshttp://ix.io/1Ou0/nim
13:30:44*jjido joined #nim
13:31:39*jjido quit (Client Quit)
13:31:42*alexander92 quit (Ping timeout: 245 seconds)
13:33:41FromGitter<mratsim> test is in file 3? :p
13:33:59Skarutshmm, let me try that
13:34:06*jjido joined #nim
13:34:29*Senketsu quit (Quit: WeeChat 2.5)
13:34:45*sniffdtek quit (Remote host closed the connection)
13:34:58*sniffdtek joined #nim
13:40:16*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:43:31pbbthanks everyone I found the culprit. my reference to the modbus context was stored as a ref object, which the garbage collector was trying to touch I guess
13:43:42pbbchanging the type to pointer solves the issue
13:43:56disrupteknice.
13:44:55disrupteki wonder if we can come up with a better way to identify that error case and provide a little more detail into what happened.
13:45:22disruptekdo we know if pointers are foreign?
13:46:17*Perkol joined #nim
13:46:42disruptekfeels technically impossible, but the compiler is a mysterious place.
13:46:53pbbwhat do you mean y foreign?
13:46:57FromGitter<mratsim> There used to be a feature that no one used that associated pointers to a memory region and prevented mixing them
13:46:58pbb*by
13:47:04*Perkol quit (Client Quit)
13:47:14Skaruts@mratsim so far so good, I have type Person in file 4, Woman in 3, Man in 2, and I instantiate both and they find their respective procs
13:47:27*jjido joined #nim
13:47:32disruptekhow could you prevent the assignment of an "invalid" pointer when it's just an integer to twiddle at whim?
13:47:47FromGitter<mratsim> it was part of the type
13:47:59*brakmic quit (Read error: Connection reset by peer)
13:48:33disruptekis your modbus context a native nim object? i got the impression this was a c interop issue, but i didn't follow it closely. i just logged...
13:48:37*brakmic joined #nim
13:49:22disruptekmratsim: oh, so that was a special blessed pointer type?
13:49:42disruptekor was it an operator?
13:50:02FromGitter<mratsim> https://github.com/nim-lang/Nim/blob/v0.18.0/doc/manual/types.txt#L874-L889
13:50:28FromGitter<mratsim> it was an annotation for ref and ptr types
13:50:51FromGitter<mratsim> I think you can reproduce most of the functionality with distinct types though
13:50:58disrupteki use my trackball so infrequently that every time i do, it delays a second or two while it resumes from sleep. 1st world problems.
13:51:59disrupteka distinct pointer type? if you could annotate that, then you could ensure it doesn't mix in the heap.
13:52:34pbbdisruptek: my modbus context is a c struct
13:52:42*vlad1777d joined #nim
13:53:16FromGitter<mratsim> I use distinct pointer to differentiate between pointers coming from an immutable view and coming from a mutable view: https://github.com/numforge/laser/blob/master/laser/tensor/datatypes.nim#L13-L14
13:53:32FromGitter<mratsim> and avoid mutation by accident.
13:53:43*Senketsu joined #nim
13:54:14disruptekyeah, so it's a pointer to a c value. just wondering if the compiler is smart enough to know the difference.
13:54:41disrupteki'm just not convinced that it's technically possible, given the necessary semantics of a pointer.
13:55:46FromGitter<mratsim> my distinct pointers work if you're talking to me, I didn't define a proc that allows mutation for the immutable view: https://github.com/numforge/laser/blob/master/laser/tensor/datatypes.nim#L104-L111
13:56:04FromGitter<mratsim> and it's tested: https://github.com/numforge/laser/blob/master/tests/test_tensor_immutability.nim#L15
14:00:29*Senketsu quit (Quit: WeeChat 2.5)
14:01:58disrupteki don't get it; what does this have to do with differentiating between pointers to foreign code objects and object we've created in our gc? i mean, how does this problem even manifest?
14:02:03*__Myst__ left #nim ("WeeChat 2.5-dev")
14:03:15FromGitter<mratsim> you can always create a distinct type for pointers to forein object with a restricted set of proc.
14:04:02disruptekyeah, but that's closing the barn doors behind the horse. we're talking about a way to detect this issue before it happens and warn about it at compile time.
14:04:08*dwdv left #nim ("User left")
14:06:46disruptekto put this another way, i feel like the gc shoulda known better.
14:09:05Zevvrayman22201: https://github.com/zevv/Nim/commits/zevv-events
14:10:12Zevvnot really happy, but it seems to be the most obvious way to go. io selector now passes a uint64 id through trigger() and poll(), which ends up in ReadyKey. (only implemented for epoll for now).
14:11:41ZevvAsyncdispatch only creates one global SelectEvent and each AsyncEvent gets an unique ID. Triggering the asyncEvent triggers the selectEvent with the unique ID, and the async runOnce then calls the proper callback. I made a new callback type because the fd makes no sense there
14:15:03*Senketsu joined #nim
14:21:31*Senketsu quit (Quit: WeeChat 2.5)
14:27:36Araqping Zevv
14:28:53Zevvhere
14:29:07Zevvbut traveling, so on and off
14:30:03Cadeyis there an automatic formatting tool for Nim?
14:30:36lqdev[m]yes, nimpretty
14:33:29AraqZevv: please take a look: https://ci.appveyor.com/project/dom96/nim/builds/25884387/job/cmfhjt0ugx4087pa/tests
14:33:38Araqis 'Inst' a ref type?
14:33:52Araq(or does it contain a 'ref')
14:36:49Zevvis contains a NimNode, is that a ref?
14:36:58Zevvcant check now on mobile
14:36:59lqdev[m]yes
14:37:05Zevvthere you have it
14:37:08lqdev[m]NimNode = ref NimNodeObj
14:37:24Zevvright. why does your test break, is that newruntime?
14:40:09AraqI fixed a bug :P
14:40:22Araqand now the compiler is picky about 'const'
14:41:19Zevvhm it doesnt need to be const, let should be fine
14:41:26ZevvIll change when I get home
14:42:24*Vladar joined #nim
14:43:06Zevvthe nimnode is in a variant branch that is not used be the const though, does that matter?
14:46:19dom96Zevv: oh cool, you've made async event use less FDs?
14:49:26*gangstacat quit (Ping timeout: 252 seconds)
14:52:11*Senketsu joined #nim
14:52:26Zevvtried to. But it's a prickly business, some legacy stuff making things not so nice
14:53:52dom96A good approach might be to do it in a similar way to sleepAsync vs. addTimer
14:54:12dom96where addTimer creates an fd, whereas sleepAsync uses a lightweight mechanism that is handled by the dispatcher
14:54:40*gangstacat joined #nim
14:55:00Zevvit is pretty lightweight now I guess, take a look at my branch and description, does that make sense?
14:55:58Zevv@Araq: hmm, if I drop the const npeg can't make compile time parsers anymore...
14:57:35*Senketsu quit (Quit: WeeChat 2.5)
14:59:47*MH026 quit (Remote host closed the connection)
14:59:50disruptekZevv: is that really important? 🙄
15:00:22Zevvit's a nice feature, imho
15:00:34disruptekagree; i'm just teasing. :-P
15:01:28disrupteki'm sure araq has 3-4 alternatives teed up.
15:01:48Zevvhm I'm not sure how to fix this. I use NimNode to pass a code block around, no idea how to do this any other way. ideas?
15:03:30Zevvoh look, I fixed it :)
15:03:42disruptek?
15:05:00ZevvI had a const table with things that were built at const time. I now defer the building of things to a later moment. Still at compile time, but that does work
15:05:14dom96bah, when you add `if true: quit()` into httpclient for testing, and then 3 days later wonder why your programs stop working...
15:05:31FromGitter<rtnlmeme-DestroyerOfDeath> hi, newcomer here. With choosenim, I installed "stable" just fine. But when I try to install "devel" I run into this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d2b44bb54d338393706c4cb]
15:05:49disruptekouch, been there, but with a microservice. *facepalm*
15:06:31dom96@rtnlmeme-DestroyerOfDeath guessing devel is broken. Araq?
15:06:53FromGitter<mratsim> there is a quit somewhere in the VM if you try to access a variant field from the wrong kind ....
15:07:37disrupteksurely someone here has commit.
15:09:05Zevv@Araq: npeg is fixed for araq-fixes-5870
15:09:53Zevvdom96: I'll discuss and rework the async stuff with rayman22201, if we both agree we'll ask you for a review, is that ok with you?
15:10:01dom96sure
15:10:14Zevvsweet
15:10:35dom96Please make my job easier though and make the PR(s) as small as possible :)
15:11:09Zevvthere's always a tradeoff. Small PRs are nice, but sometimes refactoring stuff is nice too.
15:11:31ZevvThere's also a bug in the epoll selector event handling imho. It uses eventfd(), but does not check how many times it has been written
15:11:39Zevvso it drops events
15:12:33Araqdom96: oh hmm
15:12:52*lritter joined #nim
15:15:09Araqtry again
15:15:45AraqZevv: bah that sucks though, I can make Nim smarter about NimNode instead
15:16:49Zevvwell, I'm fine for now, I just moved some small thing around and all is ok
15:17:10Zevvjust pushed new nimble version 0.12 with fix
15:20:33*vlad1777d quit (Ping timeout: 248 seconds)
15:21:41*Senketsu joined #nim
15:22:46*Skaruts quit (Remote host closed the connection)
15:23:53dom96hrm, i'm seeing this really strange bug with Table.clear(). Where I am effectively doing: let copy = myTable; myTable.clear; for key, val in copy. And the iterator doesn't iterate over the values, it's as if the copy was also cleared but I checked the len and it hasn't changed.
15:25:07disruptekmaybe the new code that turns off mutability for unsafe table ops? what type of table?
15:29:14*dankrad joined #nim
15:29:20*Senketsu quit (Quit: WeeChat 2.5)
15:32:39*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:33:10dankradhi, how can i call a `$` proc from a specific module? I'm getting an ambiguous call error. I've tried modulname.$(value) and modulename.`$`(value).
15:33:34FromGitter<mratsim> that should work
15:33:49FromGitter<mratsim> the last one
15:35:47dankradThe last one gives me (im using winim): undeclared identifier: 'winstr'. My code snippet: winstr.`$`(process.szExeFile)
15:36:55dankradohh, sorry. i forgot to import winstr o.O
15:37:01dankrad;)
15:37:15dankradbut thanks anyway mratism : )
15:37:22*alexander92 joined #nim
15:44:06rayman22201@Dom96 the reason @Zevv is doing this asynFD thing is because the flowVar PR exposed a bug. It won't pass the CI tests because flowVar creates a new asyncEvent for every spawn, and thus a new FD for every spawn. If you have a lot of spawns it quickly eats up all the FDs on your system.
15:45:12*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
15:45:17dom96rayman22201, yeah, I skimmed the convo
15:45:42dom96Maybe we could create the async event only when the callback is set?
15:45:54dom96we should probably do this anyway to be honest
15:46:02rayman22201Ok cool. Just making sure you were up to date. 😁
15:46:25*laaron joined #nim
15:46:50*Senketsu joined #nim
15:47:27rayman22201I agree. It's technically a feature, but it can also be seen as a terrible resource leak.
15:47:42dom96it's yet another allocation
15:47:56dom96doing it only when await is called would be better
15:49:59rayman22201How can we know?
15:50:21dom96when await is called the callback is set
15:53:45*dankrad quit (Ping timeout: 258 seconds)
15:55:33rayman22201So override the setter in the flowVar
15:56:33Zevvmakes sense
15:58:35Zevvis cheatfate on irc?
16:00:38rayman22201Lol. @Zevv, reading your capde. the global FD is basically what I suggested yesterday 😜
16:01:18rayman22201S/capde/code/
16:02:35*jjido joined #nim
16:03:15rayman22201You meh, but I told you so 😆
16:03:44rayman22201Joking aside, I think it looks good. We should continue with the other poll impls
16:04:51rayman22201bbl
16:05:36*dankrad joined #nim
16:12:12*dankrad quit (Quit: Lost terminal)
16:16:28*Senketsu quit (Quit: WeeChat 2.5)
16:20:12ZevvMe not meh, me bah
16:38:39*sagax joined #nim
16:47:50*Senketsu joined #nim
17:10:44*kungtotte quit (Quit: WeeChat 2.5)
17:18:09*Senketsu quit (Quit: WeeChat 2.5)
17:29:30*laaron quit (Remote host closed the connection)
17:30:01*Senketsu joined #nim
17:32:07*laaron joined #nim
17:37:07*Senketsu quit (Quit: WeeChat 2.5)
17:41:10*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:50:42*actuallybatman joined #nim
17:54:39FromGitter<ratiotile> I'm getting a type mismatch: `proc `+`*T; Scale: static[cint (this: Point[T, Scale], p: Point[T, Scale])` called with `Pointcint, POSITION_SCALE (x:1, y:2) + Pointcint, POSITION_SCALE (x:1, y:0)`
17:57:37FromGitter<ratiotile> simplified: `Pointtypedesc[int (x:1, y:2) + Pointtypedesc[int (x:1, y:0)`
17:59:25FromGitter<ratiotile> required type: Point[+.T, +.Scale] but expression 'Pointcint, 1 (x: 1, y: 2)' is of type: Point[system.cint, 1]
18:03:33*Senketsu joined #nim
18:04:48FromGitter<ratiotile> trying to wrap: `Point<T, Scale> operator + (const Point<T, Scale> &p) const`
18:05:31*Senketsu quit (Client Quit)
18:09:05*Senketsu joined #nim
18:13:58FromGitter<ratiotile> here's a small reproduction : https://pastebin.com/X3MbmM9j
18:14:11*Swedneck2 is now known as Swednec6
18:14:42*Swednec6 is now known as Swednec8
18:18:47*huuskes joined #nim
18:20:31Araqhttps://github.com/nim-lang/Nim/issues/7209 is the bug
18:21:38FromGitter<ratiotile> Good to know, so copy+paste wrapping it is!
18:32:11*Senketsu quit (Quit: WeeChat 2.5)
18:33:33FromGitter<ratiotile> Shouldn't this `proc `==`*T: Position|WalkPosition|TilePosition (this, pos: T): bool ` be more specific than the builtin op ==? It gives me ambiguous error
18:35:39FromGitter<ratiotile> never mind, i got it: `proc `==`*(this, pos: Position|WalkPosition|TilePosition): bool `
19:04:58*Senketsu joined #nim
19:07:59*Senketsu quit (Client Quit)
19:11:11*natrys joined #nim
19:20:03*Senketsu joined #nim
19:23:42*kungtotte joined #nim
19:24:31*absolutejam3 joined #nim
19:25:17*Senketsu quit (Quit: WeeChat 2.5)
19:28:19*Senketsu joined #nim
19:30:43*Senketsu quit (Client Quit)
19:31:26*nsf quit (Quit: WeeChat 2.4)
19:35:32*Senketsu joined #nim
19:40:11*Senketsu quit (Client Quit)
19:49:32*laaron- joined #nim
19:50:23*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
19:52:10*kungtotte quit (Quit: WeeChat 2.5)
19:53:04*kungtotte joined #nim
19:57:10*absolutejam4 joined #nim
19:57:58*absolutejam3 quit (Ping timeout: 268 seconds)
20:01:24*Senketsu joined #nim
20:04:38*Senketsu quit (Client Quit)
20:15:32*narimiran_ joined #nim
20:16:29*narimiran_ quit (Remote host closed the connection)
20:17:40*narimiran quit (Ping timeout: 246 seconds)
20:18:27*jjido joined #nim
20:19:13*brakmic quit ()
20:35:34*PMunch joined #nim
20:47:11*Senketsu joined #nim
20:55:38*shomodj joined #nim
21:00:34*shomodj quit (Ping timeout: 272 seconds)
21:03:20*shomodj joined #nim
21:09:31*sniffdtek quit (Remote host closed the connection)
21:13:12*Vladar quit (Remote host closed the connection)
21:16:31*sniffdtek joined #nim
21:18:55FromGitter<zacharycarter> Will deques in the future not need to be initialized (like tables and sequences)?
21:26:55Araqsure, was an oversight
21:27:23*solitudesf quit (Ping timeout: 268 seconds)
21:28:21PMunchHow was that implemented by the way? Compiler magic, or just some checks to ensure that a completely null element would be treated correctly?
21:35:51*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:35:52*matti quit (Quit: Reconnecting)
21:36:05*matti joined #nim
21:36:06*matti quit (Changing host)
21:36:06*matti joined #nim
21:44:24PMunchHmm http://ix.io/1OwF
21:46:26PMunchThis issue is really annoying..
21:55:43*matti quit (Quit: Oh dear ...)
21:56:39*matti joined #nim
21:57:01FromGitter<zacharycarter> cool!
21:57:33*sniffdtek quit (Remote host closed the connection)
21:57:43FromGitter<zacharycarter> got a lot done today - got a terrain shader written and I started actually buffering vertex data :D hopefully by tomorrow I can actually draw something to the screen besides GUI stuff
21:59:42AraqPMunch, just some checks added
21:59:43dom96heh, looks like I underestimated how much using JSON for a real-time multiplayer game would cost
21:59:53dom96This is where all my perf was going
22:00:58PMunchOkay cool, so the same idea can be applied to any data structure :)
22:01:08*absolutejam4 quit (Ping timeout: 244 seconds)
22:01:13FromGitter<zacharycarter> could check out WebRTC
22:01:32dom96JSON is the problem, not websockets
22:01:46dom96but yeah, WebRTC is an option
22:01:56PMunchWhat are you using the JSON for?
22:01:57FromGitter<zacharycarter> well I mean - what else are you going to use? msgpack or something?
22:02:14PMunchMaybe protobuf could help?
22:03:19FromGitter<zacharycarter> it will probably help - but how much is the question
22:03:27dom96WebRTC is just a transport, no?
22:03:47dom96It will help a lot. Currently I'm literally using `$(%msg)`
22:04:00dom96Which means I allocate JsonNode's + strings
22:04:10dom96which sucks a lot for performance
22:04:35FromGitter<zacharycarter> yes it's just a transport - but I imagine it's magnitudes faster than websockets if you use something like - http://w3c.github.io/webrtc-pc/#peer-to-peer-data-api
22:05:05dom96I'd have to implement a webrtc server though
22:05:09FromGitter<zacharycarter> yeah
22:05:11dom96websockets should do
22:05:35FromGitter<zacharycarter> I mean other people use websockets for multiplayer games so I imagine you should be able to as well
22:05:37dom96That would be a good option if I get sick of the websockets package though :)
22:05:47dom96I won't have to reinvent the wheel
22:06:07FromGitter<zacharycarter> http://buildnewgames.com/optimizing-websockets-bandwidth/ - might be a good article
22:06:10dom96surprisingly webrtc has good web browser support too
22:06:34dom96I might implement thrift or something
22:06:56dom96(Mainly because FB uses it internally a lot so it would be nice to support it first class)
22:09:24*natrys quit (Ping timeout: 244 seconds)
22:19:21Araqdom96: try packedjson?
22:21:34dom96yeah, I'll try that
22:21:50dom96I don't want to send this data with JSON in the long run though anyway
22:23:01*natrys joined #nim
22:25:19*natrys quit (Client Quit)
22:25:57*abm joined #nim
22:34:59FromGitter<Obround> In Nim, is there someway you can access a variable before it is assigned (forward deceleration for variables)?
22:43:50*abm quit (Read error: Connection reset by peer)
22:49:32PMunchObround, what would that look like?
22:50:51*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:53:10FromGitter<Obround> Like this:
22:53:25*disruptek quit (Ping timeout: 246 seconds)
22:54:11FromGitter<Obround> Like this: ⏎ ⏎ ```var x = 0 ⏎ echo x ⏎ x = 10``` ⏎ ⏎ The output should be `10` [https://gitter.im/nim-lang/Nim?at=5d2bb29354d338393709dc6e]
22:54:12*disruptek joined #nim
23:03:59PMunchUhm..
23:04:07PMunchAnd what do you plan on using this for?
23:05:07PMunchI guess it would be possible to implement something like that..
23:24:13FromGitter<Obround> <PMunch> -- Just a little project ;)
23:24:28PMunchSounds like a weird design decision :P
23:24:36PMunchWould create some really interesting bugs
23:24:42FromGitter<Obround> Yea
23:25:06PMunchSo by default it's not possible. But with metaprogramming you can definitely do something like that
23:25:24FromGitter<Obround> Could you give an example?
23:25:42PMunchWell I'm still not 100% what behaviour you'd want
23:25:55PMunchvar x: int; echo x; x = 10; x = 20
23:26:03PMunchWhat would it output in this case for example?
23:26:26FromGitter<Obround> It would output 20
23:26:32FromGitter<Obround> or 10
23:26:47FromGitter<Obround> I didn't think of that...
23:26:53PMunchHaha :P
23:26:56FromGitter<Obround> :D
23:28:12FromGitter<Obround> Maybe there could be something like Python's global statement...
23:28:18PMunchI meany you could use defer to do something like that: https://play.nim-lang.org/#ix=1OwV
23:28:42PMunchBut that just moves the echo x to the end of the procedure body
23:29:01FromGitter<Obround> hmm...
23:30:13PMunchHow would this be anything like a Python global?
23:30:20PMunchAnd Nim already has global variables..
23:36:55FromGitter<Obround> I wasn't 100% sure of what python's global statement did...
23:37:47FromGitter<Obround> I was 80% sure it was something like a forward deceleration.
23:37:57FromGitter<Obround> :)
23:38:22FromGitter<Obround> ..
23:42:22PMunchOh no, it's just a way to access global variables
23:49:00FromGitter<ratiotile> Having trouble getting the value out of an std::iterator ⏎ `proc `[]`*T (this: ListIter[T]): T {.importcpp: "(*#)", header: "<iterator>".}`
23:49:56FromGitter<ratiotile> `Error: expression 'it[]' has no type (or is ambiguous)`