<< 26-08-2019 >>

00:01:28*ng0 quit (Quit: Alexa, when is the end of world?)
00:11:32*rockcavera joined #nim
00:18:37FromGitter<deech> IIUC `method` is a runtime dispatch construct so some type information must be kept around at runtime, is there any documentation that specifies what and when that happens?
00:20:52*theelous3 quit (Ping timeout: 248 seconds)
00:26:28FromGitter<gogolxdong> the error has gone.
00:26:28FromGitter<Vindaar> @deech the only place I'm aware of that mentions RTTI at all is the typeinfo module: https://nim-lang.github.io/Nim/typeinfo.html ⏎ I'm off to bed now. Good night :)
00:41:34*luis_ quit (Remote host closed the connection)
00:49:01*sagax quit (Ping timeout: 244 seconds)
00:50:15*user0225 quit (Quit: user0225)
00:52:34*krux02_ quit (Remote host closed the connection)
00:56:20*Kaivo quit (Ping timeout: 272 seconds)
01:07:16*arecaceae quit (Read error: Connection reset by peer)
01:07:40*arecaceae joined #nim
01:12:47*Jjp137 quit (Read error: Connection reset by peer)
01:13:30*Jjp137 joined #nim
01:26:41*laaron joined #nim
01:50:17xacecould someone help explain what happens on this line: https://github.com/kitsunyan/pakku/blob/1f6a5c6188a80bab511f56cb36eae824765c89d6/src/feature/syncinstall.nim#L312 # my understanding is that `editorEnv` is a string variable. What happens when you just put the string variable like that?
01:58:45xaceoh, nvm now i see that it's part of a if-statement
02:54:03*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
02:54:32*laaron joined #nim
03:16:35*LEdoian[m] joined #nim
03:20:28*livcd quit (Ping timeout: 246 seconds)
03:28:46*livcd joined #nim
03:29:57*dddddd quit (Remote host closed the connection)
03:48:03*chemist69 quit (Ping timeout: 264 seconds)
03:49:32*chemist69 joined #nim
04:01:05*darithorn quit (Read error: Connection reset by peer)
04:02:02FromGitter<gogolxdong> D:\Nim\lib\system\jssys.nim(53, 6) Error: 'getCurrentException' is not GC-safe as it accesses 'lastJSError' which is a global using GC'ed memory ⏎ when compile nimx with task nake js
04:04:54*fjellfras joined #nim
04:08:43*laaron quit (Remote host closed the connection)
04:11:06*laaron joined #nim
04:18:33*rockcavera quit (Remote host closed the connection)
04:26:05FromGitter<kayabaNerve> Use `except Exception as e`
04:27:37*owl_000 quit (Ping timeout: 250 seconds)
04:46:28*endragor joined #nim
04:51:20*nsf joined #nim
04:59:17*laaron quit (Remote host closed the connection)
05:01:53*laaron joined #nim
05:06:09*snooptek joined #nim
05:15:56*narimiran joined #nim
05:17:32*owl_000 joined #nim
05:26:12owl_000what enum {.pure.} pragma does? i added {.pure.} and can't find any differences.
05:28:32owl_000and is enum values can be only string?
06:04:14FromGitter<zacharycarter> owl_000: pure forces you to address enum values as EnumName.EnumValue
06:04:19Zevv.pure. enums allow for names to collide
06:04:30FromGitter<zacharycarter> to allow for ^
06:04:40Zevvzacharycarter: you're not forced to qualify
06:04:50FromGitter<zacharycarter> oh? I thought you were
06:05:43Zevvonly for non-unique values
06:09:49FromGitter<zacharycarter> ah okay
06:10:07livcdgood morning
06:10:23livcdgogolxdong: you around?
06:10:47FromGitter<zacharycarter> I think the best thing to do is for an enum named `FooEnum` prefix all values with `fe` so like `feFoo` feBar` etc...
06:10:59*solitudesf joined #nim
06:23:47*actuallybatman quit (Ping timeout: 245 seconds)
06:23:47Zevvthat is *soo* C
06:27:30lqdev[m]but it doesn't cause as many problems as in C (namespacing)
06:28:41*PMunch joined #nim
06:36:05*Vladar joined #nim
06:44:11*tankf33der joined #nim
06:59:53*tankf33der left #nim (#nim)
07:00:00*gmpreussner quit (Quit: kthxbye)
07:03:52FromGitter<zacharycarter> I don't really mind if some C patterns are baked into Nim
07:03:52FromGitter<zacharycarter> but others *cough Zevv* take offense for some reason :P
07:03:52FromGitter<zacharycarter> like when you use `const FOO_BAR = 1`
07:03:52FromGitter<zacharycarter> I have a feeling that makes Zevv twitch / cringe
07:04:49*gmpreussner joined #nim
07:08:51FromDiscord_<Shield> you gotta scream those consts
07:12:27Zevvoh no I love that
07:12:34ZevvI'm a C man, and too old to ever change
07:12:42FromGitter<zacharycarter> lol
07:12:50ZevvI hate it that nim has no proper preprocessor to abuse
07:12:55Zevvall this fiddling with macros, bah
07:26:03FromGitter<zacharycarter> hahaha
07:26:53FromGitter<alehander42> you can kinda do it with source filters
07:27:00FromGitter<gogolxdong> @livcd yes
07:31:46*krux02 joined #nim
07:37:36*sagax joined #nim
07:43:07Zevvwow lets make an m4 compatible source filter
07:46:58FromGitter<alehander42> 1) term rewriting macros
08:23:10*floppydh joined #nim
08:26:08livcdgogolxdong: Do you know xcgui ?
08:27:15PMunchlivcd, hard to find any english docs on it it seems
08:28:16*shomodj joined #nim
08:29:26FromGitter<gogolxdong> what's that?
08:29:59livcdsome chinese gui lib
08:30:03livcdhttp://www.xcgui.com/
08:30:48*shomodj quit (Client Quit)
08:33:38PMunchWindows only by the looks of it
08:35:32FromGitter<gogolxdong> yeah, it's Windows only.
08:37:37*floppydh quit (Quit: WeeChat 2.5)
08:42:44*shomodj joined #nim
08:51:36PMunchHmm, what are the current differences between a normal build and -d:release?
08:52:04PMunchMy program fails when I compile with -d:release on 0.20.2, but works fine without
08:53:39*ng0 joined #nim
08:54:55Zevv"fails"?
08:56:07PMunchIt's doing some decryption, which comes out garbled on a release build
08:57:53leorizeI think the only diff are: stacktrace off, -O3 optimization on
08:58:49leorizeI think -O3 is messing up with your code, try passing -d:release -t:'-O0' and see if it's working
08:59:32PMunchNope, still messed up
08:59:44PMunchWas that supposed to be -t
09:00:05leorizeit's --passC, I think the sort form is -t
09:00:43leorizetry --opt:none then
09:01:10PMunchAh, it's definitely -O3 that does it
09:01:33PMunchBut passing -O0 to a release build adds both flags, and the GCC compiler chooses O3
09:02:01PMunchJust passing O3 without release messes up as well
09:02:37PMunchSome for O1
09:02:58ZevvSo O3 messes up your nim-generated code?
09:03:00PMunchHmm, strange, this used to work..
09:03:27PMunchZevv, I don't think O3 does anything to the code does it?
09:03:37Zevvwell, it can break *bad* code
09:03:47Zevvor fix it, depending on how you look at it
09:03:52Zevvit typically changes UB
09:04:02Zevvbut nim generated C code should never show UB, right
09:04:27leorizewell gcc optimization make code fails faster :P
09:04:39Zevvthat much is true :)
09:05:00leorizeI'm not entirely sure if -O3 is that safe
09:05:22Zevvwell, it is supposed to be
09:05:28leorizelibgcrypt has special override for certain part of it to disable gcc optimization
09:06:16leorizePMunch: if you have clang with sanitizer, try -t:'-fsanitizer=ubsan' -l:'-fsanitizer=ubsan'
09:07:41PMunchOnly got GCC on this machine
09:10:22ZevvDoes O2 work for you?
09:10:28PMunchNope
09:10:33Zevvthat is very bad
09:10:46PMunchOnly O0 works
09:11:11leorizecan you share the code?
09:11:16PMunchO[1|2|3] fails
09:11:27PMunchSure, it's my libkeepass repo on GitHub
09:11:29leorizeif -O1 fails then the code is already broken :P
09:12:04Zevveuh but that's a python module?
09:12:18Zevvare you sure you're on the right irc channel? :)
09:13:52PMunchhttps://github.com/PMunch/libkeepass
09:13:55PMunchIt's a Nim module
09:14:24*solitudesf quit (Read error: Connection reset by peer)
09:14:26*solitudesf- joined #nim
09:18:43PMunchHmm, it seems like it has something to do with the salsa module or how it's used
09:19:15PMunchBut I can't get that module itself to misbehave
09:19:38PMunchBut adding an echo of pwBytes right after this line: https://github.com/PMunch/libkeepass/blob/master/src/libkeepass.nim#L256
09:19:53PMunchShows that it decrypts the first password just fine, but then it starts failing
09:22:06narimirani think my `nimble` is broken (i can't install packages), and running `koch nimble` didn't make my problems go away. what now?
09:22:38PMunchOkay this is very strange..
09:23:04PMunchI added some echo statements before the crypt, and keyArr changes when run with O3, but not when run with O0
09:26:47PMunchOkay, moved the pointer dereference from here: https://github.com/PMunch/libkeepass/blob/master/src/libkeepass.nim#L256 to here: https://github.com/PMunch/libkeepass/blob/master/src/libkeepass.nim#L211 and now it works fine with -d:release as well..
09:27:46PMunchOh well, off to lunch now. If anyone has any idea what causes this (Is it even a Nim bug? Codegen bug?) please ping me
09:27:57Zevvnarimiran: "broken"?
09:28:15Zevvdoes it complain? Clean your nimblecache?
09:29:45narimiranZevv: here is the output, it is the same/similar with different packages: http://ix.io/1TvM
09:34:09narimiranhere is what is in /tmp/....: 1. blake2.ini: http://ix.io/1TvN ; 2. blake2.nims: http://ix.io/1TvO
09:34:52Zevvyeah I got just that one
09:35:04Zevv./koch --latest nimble
09:35:14Zevvor update your koch and rebuild koch manually
09:37:08narimiranyep, i needed to update `koch` before running `koch nimble`. thanks!
09:37:56Zevvthe root cause is warnings about unused imports. If you have a nimble file without custom targets, strutils is imported and not used, and the 'nim e' error message ends up in the .ini file in the nimble cache.
09:58:29leorizeI wouldn't want to know how that's implemented
10:12:28*fjellfras quit (Quit: Leaving)
10:13:58FromGitter<alehander42> what's new these days in nim
10:14:16narimiranunused imports warning :)
10:16:50Zevvunused import warnings *everywhere* :)
10:20:13FromGitter<alehander42> i am just trying to get rid of
10:20:14FromGitter<alehander42> XDeclaredButNotUsed
10:20:18FromGitter<alehander42> warnings
10:20:26FromGitter<alehander42> but for some autogenerated stuff by a serialization
10:20:31FromGitter<alehander42> what was the switch : )
10:21:25FromGitter<alehander42> --hint[XDeclaredButNotUsed]:off
10:21:26FromGitter<alehander42> ok
10:21:55FromGitter<alehander42> so if we pass a similar switch, does this fix the import thing
10:22:06FromGitter<alehander42> or do you want to still see the "actual" unused ones :P
10:22:39narimirani like this new feature, i cleaned up some of my code. and the same happened in lots of places in stdlib
10:25:00*lritter joined #nim
10:32:38dom96I feel like having this many ways to install Nimble is doing us a disservice
10:33:03dom96at the very least, koch needing to be recompiled for this thing is non-intuitive so it might be a good idea to move the Nimble version it installs to a text file or something
10:35:32*owl_000 quit (Quit: Leaving)
10:44:32leorize@alehander42: you can always tag your auto generated stuff with {.used.} :P
10:44:49leorizehmm, does that pragma also work for modules?
10:45:23*laaron quit (Remote host closed the connection)
10:48:33*laaron joined #nim
10:50:32FromGitter<alehander42> leorize, hm, nice
10:50:34FromGitter<alehander42> thank you
10:59:09*floppydh joined #nim
11:08:45dom96hm, is it a holiday in Germany today too?
11:09:25FromGitter<Vindaar> nope
11:12:38dom96Haven't seen Araq in a while
11:12:52narimiranhe said he'll be here later today
11:14:26livcddom96: he is stuck reading Gordon's posts
11:14:34narimiranlol
11:15:25*JustASlacker joined #nim
11:18:19livcdBut I also want to retire to Thailand like Gordon
11:20:06*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:26:50*laaron quit (Remote host closed the connection)
11:28:31*laaron joined #nim
11:32:04FromGitter<mratsim> @alehander42 there are a couple of XDeclaredButNotUsed issue on the tracker (including the main one that has been closed by workaround)
11:33:31FromGitter<mratsim> see and linked issues: https://github.com/nim-lang/Nim/issues/4044
11:34:14FromGitter<mratsim> and https://github.com/nim-lang/Nim/issues/11826
11:35:42*owl_000 joined #nim
11:36:09owl_000is it possible to store value e.g.float in enum variants
11:39:37FromGitter<alehander42> but does
11:39:39FromGitter<alehander42> hint and warning
11:39:43FromGitter<alehander42> do the same ? @mratsim
11:39:48FromGitter<alehander42> i use --hint
11:40:18FromGitter<mratsim> @owl_000 yes: https://nim-lang.org/docs/manual.html#types-object-variants
11:40:45FromGitter<mratsim> @alehander42 I suppose they are implemented the same way
11:41:16FromGitter<alehander42> i think owl means
11:41:25FromGitter<alehander42> enum A = 0.1 B = 0.2 etc # pseudo
11:41:36FromGitter<alehander42> i think this was possible with strings ..
11:44:14owl_000yes, only string can be stored in enum, if i write like this, 'value=2' it becomes ord, it can be printed by echo ord(value)
11:44:18FromGitter<alehander42> sorry @mratsim your suggestion is really better for @owl_000 imo
11:44:39FromGitter<alehander42> using variants would be probably better as one needs more stuff
11:44:41FromGitter<alehander42> anyway
11:44:46FromGitter<alehander42> otherwise one can do https://forum.nim-lang.org/t/110
11:44:50FromGitter<alehander42> yeah
11:45:00FromGitter<alehander42> but it seems its only possible with string
11:45:28FromGitter<alehander42> but i wouldnt use that for float
11:45:52FromGitter<alehander42> whats your usecase owl_000
11:46:05FromGitter<alehander42> @mratsim yeah, they probably work the same with the pragma?
11:46:39FromGitter<mratsim> yes I think so
11:57:11owl_000docs/manual.html#types-object-variants is difficult one, i will look it later, after learning some more. i am in 'tut1 enumerations'. the description is tiny, it should be brief.
12:03:04FromGitter<alehander42> in some cases where enums dont fit, one can simply use several const-s
12:08:30*dddddd joined #nim
12:10:22*alexander92 joined #nim
12:10:36PMunchOr an array enumerated by an enum :)
12:10:55PMunchAnd possibly write a little helper macro to populate it
12:11:25PMunchLike what I did here: https://peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html
12:11:38*theelous3 joined #nim
12:15:20*Kaivo joined #nim
12:21:51dom96This was a fun one https://github.com/nim-lang/Nim/issues/12052
12:24:33*fjellfras joined #nim
12:24:47livcddom96: cg @ your promotion
12:25:01dom96thanks
12:27:46*sealmove joined #nim
12:28:07sealmovehey, would it be interesting to add Nim support for https://kaitai.io/ ?
12:29:33*rockcavera joined #nim
13:08:14*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
13:09:14FromGitter<Vindaar> would someone with mod privileges in the forum be so kind to activate my account? :) https://forum.nim-lang.org/profile/Vindaar
13:09:35*laaron joined #nim
13:12:37narimirandone
13:13:19FromGitter<Vindaar> sweet, thanks!
13:21:17*shomodj joined #nim
13:31:30krux02sealmove: there is also Protobuf and Capt'n proto. The list of binary format declaration languages is long.
13:33:03*JustASlacker quit (Ping timeout: 264 seconds)
13:35:11*abm joined #nim
13:39:46*JustASlacker joined #nim
13:54:13owl_000https://play.nim-lang.org/#ix=1TwA what is the solution? or is it possible to return two different types?
13:56:33leorizesee the options module
13:57:31FromGitter<iffy> I'm making a Nim library that is called from NodeJS. Node will often call the Nim code in one or more threads. What do I need to do within Nim to handle being called in that way? I'm already using `--gc:regions`. Do I need to enable `--threads:on`? Is there other setup code I need to call at the beginning of each thread?
13:57:32narimiranyeah, options are probably the way to go. poor man's solution might be to return a tuple `(isValid: bool, value: int)`
13:58:15leorize@iffy: just add `--threads:on` :P just in case
13:58:24leorizeare you using gc:regions correctly though?
13:58:36FromGitter<iffy> hehe, probably not
13:58:52FromGitter<iffy> when I add `--threads:on` my test program actually crashes
13:58:59leorizeswitch to devel then embrace --newruntime :P
13:59:09FromGitter<iffy> well...
13:59:44Araqiffy you need setupForeignThreadGc
13:59:54FromGitter<iffy> I have already released a version to users that is using `--gc:regions` that works without problems. It doesn't do anything asychronous/threaded, but I'd like to start doing some
14:00:23FromGitter<iffy> Araq: is that safe to call multiple times from the same thread?
14:00:45Araqyes
14:00:58dom96Araq, hey! I've fixed the memory problems I was having. I reported two bugs which I was able to reproduce (to a certain extent): https://github.com/nim-lang/Nim/issues/12045 https://github.com/nim-lang/Nim/issues/12052. The former is IMO quite important to fix, I had to do some really annoying workarounds to get my code to work.
14:01:05leorize@iffy if you "use" gc:regions as in just passing "--gc:regions" then it's gonna be the same as "--gc:none"...
14:01:23dom96Araq, oh, sorry, actually I've got three issues. This one is the one that is the most important to fix: https://github.com/nim-lang/Nim/issues/12042
14:01:35FromGitter<iffy> leorize: oh rats, so I have to explicitly use withRegion?
14:01:44Araqdom96, ok, well
14:01:45FromGitter<iffy> I thought there was a default region
14:01:47Araqcan't be hard to fix
14:02:19dom96Araq, yeah, that one should be easy for someone that's familiar with the compiler
14:02:21leorizeyou have to deallocate regions manually
14:02:27leorizeit's not automatically collected
14:02:41dom96it will make working with openarrays much easier
14:02:46*endragor quit (Remote host closed the connection)
14:02:46leorizeand it's easier to do so with a MemRegion
14:03:22dom96there is also some weird behaviour with `set` and memory usage
14:03:50*endragor joined #nim
14:04:13FromGitter<iffy> so shall I used `--gc:regions`, `--threads:on`, and `setupForeignThreadGc`? Or some other combination?
14:04:30FromGitter<iffy> regions was recommended as ideal for a library
14:06:02*PMunch quit (Remote host closed the connection)
14:07:17leorizeif you're ready you can use --newruntime :P
14:08:00FromGitter<iffy> Is --newruntime ready for me?
14:08:04FromGitter<iffy> (also, is it documented?)
14:10:54leorizehttps://github.com/nim-lang/Nim/blob/devel/doc/destructors.rst
14:11:43*sentreen quit (Quit: sentreen)
14:15:25*sentreen joined #nim
14:16:16*endragor quit (Remote host closed the connection)
14:17:00sealmovekrux02: Which method for declaring binary formats would you recommend?
14:19:34*endragor joined #nim
14:23:47*endragor quit (Ping timeout: 245 seconds)
14:31:16FromGitter<iffy> leorize: that looks great, though I'm hesitant to base a production product on it since it's still experimental
14:31:47leorizewell gc:regions is even more experimental
14:32:10leorizeit's not actively maintained nor used afaict
14:34:01*solitudesf- quit (Remote host closed the connection)
14:34:15*solitudesf- joined #nim
14:38:18FromGitter<iffy> and now I know it's effectively "gc:none" as I'm using it, I need to reevaluate.
14:43:19krux02sealmove: I would write a macro that does binary serialization in Nim only. I did that in the past, it gives me the control I need plus the automation I want.
14:46:00sealmoveBut serialization is not the only use-case. My use-case is parsing existing formats like the Windows Registry. Making a macro for this feels like re-inventing the wheel, and it would be limited to Nim (theoretically bad, althought I don't mind atm)
14:55:37FromDiscord_<Shield> "Objects that contain pointers that point to the same object are not supported by Nim's model."
14:55:47FromDiscord_<Shield> what are the implications of this?
14:56:11FromGitter<iffy> If I distribute a nim library and include some C header files, how do I include those header files automatically when a user of my nim package compiles their program?
15:02:55*solitudesf- quit (Ping timeout: 246 seconds)
15:04:10*JustASlacker quit (Remote host closed the connection)
15:05:03*laaron quit (Quit: ZNC 1.7.1 - https://znc.in)
15:05:59*laaron joined #nim
15:11:30FromGitter<mratsim> @sealmove, kaitai looks similar to NESM https://gitlab.com/xomachine/NESM
15:12:25FromGitter<mratsim> @iffy, like this: https://github.com/mratsim/weave/blob/51401d137df36b7f12ad8b6a8092708791e21c83/benchmarks/wtime.nim#L2-L8
15:15:46sealmovemratsim: interesting, but I think this goes beyond serialization needs. Working with existing format is different than serializing data (making your own, as-simple-as-possible, format).
15:19:10*laaron quit (Remote host closed the connection)
15:21:09*laaron joined #nim
15:25:01FromGitter<mratsim> kaitai seems to be like a yaml description of a file. Similar to how nesm types would be defined
15:25:47FromGitter<mratsim> so if you could parse .ksy at compile-time, you could create the Nim type corresponding to the .ksy, and use NESM for the serialization/deserialization part
15:26:03FromGitter<mratsim> (but maybe I'm just looking too far ahead :P)
15:30:55*endragor joined #nim
15:32:55sealmovenot yet sure, but I suspect .ksy has capabilities which can't be encapsulated into a Nim type.
15:33:37*owl joined #nim
15:36:41*owl_000 quit (Ping timeout: 250 seconds)
15:37:13sealmoveor at the very least, parsing .ksy and creating Nim types for complex formats could be *very* involved
15:39:46*laaron quit (Remote host closed the connection)
15:41:54*laaron joined #nim
15:42:31lqdev[m]I'm getting a weird `The futex facility returned an unexpected error code.` error on glfwTerminate(), any ideas why it might be happening? this is the problematic line: https://github.com/liquid600pgm/rapid/blob/master/src/rapid/gfx/window.nim#L42
15:43:04lqdev[m]I'm pretty sure this is an error with my GLFW wrapper, though I can't tell what's the problem.
15:43:39sealmoveexamples: variable-length structures, fields which exist only if a condition is met, repeating patterns as padding, and so on
15:51:55FromGitter<mratsim> @lqdev: did you perhaps take a lock that you didn't release or something
15:52:03FromGitter<mratsim> a futex is a linux low-level lock
15:52:17lqdev[m]@mratsim I don't use locks in my program
15:53:16*darithorn joined #nim
15:53:30FromGitter<mratsim> maybe you forgot to dispose/release/destroy a GLFW resource that takes a lock then?
15:54:11lqdev[m]I don't think so, glfwTerminate is supposed to dispose of all resources by itself
15:55:32lqdev[m]also, this issue only started appearing on recent Mesa drivers (19.1.3)
15:55:53*sentreen quit (Ping timeout: 245 seconds)
16:00:01*owl_000 joined #nim
16:02:57*owl quit (Ping timeout: 245 seconds)
16:04:16FromGitter<mratsim> well no idea then. whip-up gdb, take a deep breath and dive
16:09:03*fjellfras quit (Quit: Leaving)
16:09:39*sentreen joined #nim
16:11:04*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:13:48lqdev[m]aah, never thought about using gdb lol
16:14:09lqdev[m]I debug Nim code mostly using echo statements XD
16:15:18FromGitter<mratsim> I don't know how you can survive low-level dev without gdb/lldb
16:20:06*sz0 joined #nim
16:21:57*a_b_m joined #nim
16:23:47*rayman22201 joined #nim
16:25:03*abm quit (Ping timeout: 245 seconds)
16:30:27*endragor quit (Remote host closed the connection)
16:31:26*actuallybatman joined #nim
16:33:38FromGitter<alehander42> make sure to import e.g. source nim-gdb.py
16:33:44FromGitter<alehander42> from tools in the compiler
16:47:17*owl_000 quit (Quit: Leaving)
16:52:29*vlad1777d quit (Remote host closed the connection)
16:55:02*vlad1777d joined #nim
17:03:21*sentreen quit (Quit: sentreen)
17:06:51*sentreen joined #nim
17:08:06*theelous3 quit (Ping timeout: 244 seconds)
17:11:51leorizeliving with exceptions is hard when you also need to not scare users...
17:12:05leorizehow do you all deal with exceptions in CLI apps?
17:12:28leorizedo you just throw it and use that as error message, or you handle it then pretty print something for the user?
17:13:12alexander92i am not sure i ever did something in nim focused on non-programmers
17:13:36leorizenot necessary to be restricted to Nim
17:14:40disrupteki figure the user has a much better idea of what to do than i do.
17:24:51FromDiscord_<DeltaPHC> Re: debugging. One small thing that would help a lot, that I've seen in some other languages, is a `dbg(x)` proc or macro that echos the value of the expression, along with the source file and line number and junk, while *also* returning that expression at that position
17:25:39FromDiscord_<DeltaPHC> That way, you can just attach `dbg(...)` to an existing expression and it'll work just the same, except you'll also get debug info
17:26:29FromDiscord_<DeltaPHC> just as a tool you can use temporarily, not something that stays in your code
17:27:11FromGitter<iffy> @mratsim thank you!
17:28:04*sentreen quit (Ping timeout: 248 seconds)
17:31:10leorize@DeltaPHC I believe the same can be replicated by a simple macro
17:31:14*sentreen joined #nim
17:32:48FromDiscord_<DeltaPHC> Oh I know. I'm just suggesting it as something that could be in the standard lib, since it could be widely useful
17:33:07FromDiscord_<DeltaPHC> enhanced print-debugging, heh
17:34:13FromGitter<alehander42> you're right
17:34:18FromGitter<alehander42> `debug` in sugar.nim
17:34:19FromGitter<alehander42> is similar
17:34:38FromGitter<alehander42> but not the same: you can write one yourself, using instantiationInfo
17:34:51FromGitter<alehander42> you can also use a full logging lib https://github.com/status-im/nim-chronicles/
17:35:13FromGitter<alehander42> but it uses a bit different approach
17:35:40FromDiscord_<DeltaPHC> I know that logging libs exist. I'm more suggesting a lighter-weight thing
17:35:43FromGitter<zacharycarter> would this be the correct way to handle this C Array?
17:35:55FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d64187bf2821072aa1a9a4a]
17:36:16FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d6418909b381b084ffb44c7]
17:36:41FromGitter<zacharycarter> and then - ⏎ ⏎ ```smap[2 * (i + w * j)] = ...;``` [https://gitter.im/nim-lang/Nim?at=5d6418a9a080d70ab585f442]
17:36:59FromGitter<zacharycarter> ```smap[2 * (i + w * j)] = ...```
17:37:15FromGitter<zacharycarter> first code block = C++
17:37:15FromGitter<zacharycarter> second = Nim
17:37:19FromGitter<zacharycarter> in both set of code blocks
17:37:47FromGitter<zacharycarter> I'm mostly concerned about the c array of floats and the Nim unchecked array of float32s
17:38:09FromGitter<mratsim> the mem[] can be implicit
17:38:17FromGitter<mratsim> mem.data will auto deref
17:38:42FromGitter<mratsim> otherwise that seems ok
17:38:54FromGitter<zacharycarter> gotcha, thanks!
17:39:26FromGitter<zacharycarter> bleh - I have no idea where my terrain example port is going bonkers
17:39:40FromGitter<zacharycarter> I guess I will go to sleep early and try to use my brain when it's fresh in the morning to figure it out
17:39:42FromGitter<zacharycarter> so very close...
17:39:59FromGitter<mratsim> you can check against my malloc implementation: https://github.com/mratsim/weave/blob/master/e04_channel_based_work_stealing/primitives/c.nim#L18-L27
17:40:40FromGitter<zacharycarter> thanks - I'll give that a slot
17:40:43FromGitter<zacharycarter> shot*
17:50:17*ng0 quit (Quit: Alexa, when is the end of world?)
17:52:02*actuallybatman quit (Ping timeout: 258 seconds)
17:52:21*actuallybatman joined #nim
17:53:30*solitudesf- joined #nim
17:53:59leorizenarimiran, Zevv, disruptek: more nim.nvim refactoring is up for testing in the 'refactoring' branch
17:54:22leorizealso, how has the refactored version work for everyone? :)
17:54:31narimiranis there something specific we should test?
17:54:47*ng0 joined #nim
17:55:00leorizewell test everything :P
17:55:06leorizeI've just rewritten the querying code
17:55:25leorizeso every nimsuggest-based tasks should be tested
17:57:14leorizethe refactoring added about 153 LoC though :P
17:57:19leorizemost of which are docs
17:57:44narimirandocumenting your own code? you're getting old....
17:58:52leorizewell I can do nim without docs
17:59:00*Trustable joined #nim
17:59:03leorizebut vimscript... no, just no
18:00:49leorizealso, does anyone notice any perf changes?
18:01:17leorizein theory things should be faster now, but most of the time spent is in nimsuggest anyway :P
18:01:57narimiranfor me it was already fast enough, but i'll see if i can spot any differences
18:02:35disruptekfeels the same to me, but i'm on a fairly quick machine.
18:03:45leorizewell perf isn't the main point of the refactoring anyway
18:03:57leorizewhat everyone should see now is less vim errors popping up
18:04:04disrupteksure; it doesn't seem slower, if that helps. 😉
18:04:08leorizeI've cut all TOCTOU bugs in the code
18:04:50disruptekyou've cut all... what?
18:05:09leorize"time of check, time of use" bugs
18:06:33leorizethe plugin used to check for several constraints that might change during execution
18:07:08*ng0 quit (Write error: Connection reset by peer)
18:07:08*leorize quit (Read error: Connection reset by peer)
18:07:08*laaron quit (Read error: Connection reset by peer)
18:08:34*laaron joined #nim
18:08:41disruptekcool.
18:11:33leorize[m]also, Zevv, I've written enough docs on how each part works for you to try adding vim8 support :p
18:13:20Zevvwho me? No, I use neovim, not vim8!
18:16:19*ng0 joined #nim
18:17:25leorize[m]I thought you complained about how I forced you to maintain config for both vims :p
18:20:13Zevvyeah, that's nasty
18:21:26lqdev[m]is there a fuzzy search for nim?
18:21:56leorize[m]fuzzy search?
18:24:32*ng0 quit (Quit: Alexa, when is the end of world?)
18:24:44alexander92i think the sublime algorithm
18:24:55alexander92was explained or open sourced somewhere
18:25:00lqdev[m]yeah, I mean like when you type `ot` into your IDE it will show you `OrderedTable` or something
18:25:04*ng0 joined #nim
18:25:56alexander92i've written one similar function in my code a long time ago, but i dont think i use it .. no idea if it works well
18:27:01alexander92ix.io/1Tyc/nim
18:27:44lqdev[m]just noticed shashlick has a fts_fuzzy_match wrapper
18:27:44alexander92https://www.forrestthewoods.com/blog/reverse_engineering_sublime_texts_fuzzy_match/ probably a better resource
18:28:09lqdev[m]but I wanted a pure Nim implementation
18:28:49*leorize joined #nim
18:31:22lqdev[m]meh, fts_fuzzy_match is written in C++
18:31:28*narimiran_ joined #nim
18:31:34lqdev[m]I'm going to port it over to Nim
18:32:21*sentreen quit (Quit: sentreen)
18:33:01*rayman22201 quit (Quit: Connection closed for inactivity)
18:33:02Araq+1
18:33:31shashlick@lqdev
18:33:33alexander92i was in a discussion in the zig channel about imposibillity ruby's dsl autocompletion
18:33:35shashlickI use it in feud
18:33:38shashlickWorks great
18:33:44alexander92so i thought about this : isnt it possible for nim macro dsl-s
18:33:48*narimiran quit (Ping timeout: 245 seconds)
18:33:51alexander92to have good advanced autocompletion
18:34:16shashlickhttps://github.com/genotrance/feud/blob/master/wrappers/fuzzy.nim
18:34:18alexander92e.g. if you use expectKind / or ast_pattern_matching on your input, or even some helper "suggest" procs
18:34:23shashlickUses nimterop and c2nim
18:34:32alexander92you can generate suggestions inside it
18:34:50alexander92hypothetically
18:35:00Araqalexander92, it is possible and not even that hard
18:35:18shashlick@lqdev what in your use case requires pure Nim
18:35:29shashlickAlso, someone else had written some fuzzy find in Nim
18:35:43Araqalexander92, tested the new karax?
18:35:46alexander92is this something that should also be in nimsuggest
18:36:29alexander92Araq, ok, just writing my todo task list: i am putting new karax in
18:37:26FromGitter<brentp> is there standard code somewhere to access an UncheckArray? e.g. with int, HSlice, etc?
18:37:57Araqbrentp: you access it via [], like any other array
18:38:09lqdev[m]@shashlick nothing really, it's just my preference. I don't want to use C++ because C is the default, more stable option
18:38:34shashlickWell why does it matter if you are only using the lib
18:39:42alexander92lqdev, shashlick is doing all this work on wrapping all the C/C++ he can find !
18:39:42shashlickYou don't need `nim cpp` for your whole app to use a c++ library
18:40:05lqdev[m]shashlick: what do I need then?
18:40:08alexander92kidding, but really, i agree we should reuse c/cpp libs
18:41:07FromGitter<brentp> @Araq. seems to allow integer acess via `[]`, but not slicing. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d6427c39b381b084ffbb46a]
18:41:19shashlickWell, at least in feud I do use cpp for the plugin that uses fuzzy
18:41:36shashlickBut you can just link with cpp mode and leave compile as is
18:41:54*wildtrees joined #nim
18:42:05shashlickSee https://github.com/nimterop/nimterop/blob/master/config.nims
18:42:17*sentreen joined #nim
18:42:44Zevvisnt there a fuzzy mach in dochack?
18:43:01Zevvtools/dochack/fuzzysearch.nim
18:45:23Araqso ... don't slice? how can you slice it anyway... slicing usually allocates
18:45:39*floppydh quit (Quit: WeeChat 2.5)
18:46:20*clyybber joined #nim
18:48:06FromGitter<brentp> fair enough
18:50:29shashlick@Araq curious what's your feedback on https://github.com/nimterop/nimterop/blob/v020/nimterop/build.nim#L498
18:51:54Araqdon't have any
18:52:00Araqbbl
18:57:56*livcd quit (Changing host)
18:57:56*livcd joined #nim
19:04:45*shomodj joined #nim
19:05:57*shomodj quit (Client Quit)
19:07:59FromGitter<brentp> how can I tell if bounds-checking is on?
19:08:42disruptekaccessing an oob index prevents compilation.
19:10:44FromGitter<brentp> `when compileOption("boundChecks")`
19:18:56*sz0 quit (Quit: Connection closed for inactivity)
19:22:19*nsf quit (Quit: WeeChat 2.5)
19:23:41*clyybber quit (Quit: WeeChat 2.5)
19:25:14*sealmove quit (Quit: WeeChat 2.5)
19:26:43FromGitter<iffy> How do I avoid this type mismatch error: http://ix.io/1Tys
19:27:09FromGitter<iffy> I think maybe it's not matching on the proc type?
19:27:13*a__b__m joined #nim
19:27:26FromGitter<iffy> hi, @brentp!
19:27:38FromGitter<iffy> thanks for noticing the argparse failure on devel
19:28:42FromGitter<brentp> hey Matt. sure! thanks for creating that package.
19:30:53*a_b_m quit (Ping timeout: 245 seconds)
19:31:00*sagax quit (Ping timeout: 272 seconds)
19:33:39FromGitter<brentp> you can use object instead of tuple and then your example works
19:34:46*clyybber joined #nim
19:34:57clyybberAraq: https://github.com/nim-lang/Nim/pull/11926 is ready now
19:35:01clyybberI removed the test
19:35:26*Ven`` joined #nim
19:37:40*Ven`` is now known as Ven_de_Thiel
19:37:44FromGitter<iffy> @brentp do you know why object works and not tuple in that case?
19:38:10FromGitter<brentp> no idea. but I've hit something similar before.
19:38:57FromGitter<iffy> From the docs here https://nim-lang.org/docs/tut1.html#advanced-types-tuples I would have thought the opposite (that tuples work and objects don't)
19:40:04*sagax joined #nim
19:52:34*devmoses joined #nim
19:53:44*netsky_ joined #nim
19:55:52*devmoses left #nim (#nim)
19:57:33*shomodj joined #nim
20:02:24*shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:14:48*netsky_ quit (Quit: Leaving)
20:17:45*a__b__m quit (Quit: Leaving)
20:22:19*abm joined #nim
20:26:54*Trustable quit (Remote host closed the connection)
20:29:49*narimiran_ quit (Ping timeout: 246 seconds)
20:40:26FromDiscord_<Kiloneie> Do you guys use Nim to program websites using JS compilation ?
20:51:29FromDiscord_<treeform> Yes. I do for work. I get paid to do it 🙂
20:53:02FromDiscord_<treeform> Works great I like it. It feels like a bit like using typescript.
20:53:27FromDiscord_<Kiloneie> I will give it a try thanks.
20:54:29FromDiscord_<treeform> Modern JS uses some thing like react and angular though. I don't.
20:54:45FromDiscord_<treeform> I stick to the classic feel JS mostly.
20:58:18*ng0 quit (Quit: Alexa, when is the end of world?)
21:02:47*Vladar quit (Remote host closed the connection)
21:03:49*ng0 joined #nim
21:14:49*clyybber quit (Quit: WeeChat 2.5)
21:16:08*shomodj joined #nim
21:18:26*Ven_de_Thiel quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:30:29*actuallybatman quit (Quit: leaving)
21:33:36*shomodj_ joined #nim
21:35:52*shomodj quit (Ping timeout: 245 seconds)
21:42:23*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
21:45:04*pbb joined #nim
21:45:56*gangstacat quit (Quit: Ĝis!)
21:51:10*abm quit (Quit: Leaving)
21:51:41*abm joined #nim
22:12:36dom96This desperately needs a signal boost: https://forum.nim-lang.org/t/5130
22:16:32*actuallybatman joined #nim
22:17:15disruptekthat looks pretty ugly.
22:19:12*solitudesf- quit (Ping timeout: 245 seconds)
22:24:22dom96disruptek, cut that out. Being condescending doesn't help anybody.
22:24:39disruptekwhat's condescending about it?
22:26:04FromDiscord_<exelotl> it didn't read as condescending to me
22:26:50ldleworkdom96: i think they just meant like 'a nasty bug'
22:27:01disruptektbh, i think his reaction is a little extreme -- threatening to divorce the pre-1.0 language from an entire industry -- but i understand his frustration. i've been there.
22:27:48disruptekthis person came from the C world; lotsa yoda ifs.
22:28:20*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
22:28:27dom96ldlework, based on what I've seen from them so far I doubt it. But that is indeed another way to interpret it, and if that is what disruptek meant then I apologise.
22:28:43ldleworkdom96: isn't -that- condescending?
22:29:07*pbb joined #nim
22:29:21disruptekno harm, no foul. just trying to put more eyes on it.
22:33:04dom96ldlework, what's condescending about it?
22:37:07dom96There is nothing wrong with trying to keep the chat a welcoming place, especially for someone who's considering leaving the community.
22:42:36FromDiscord_<Shield> is it really a threat?
22:44:35FromDiscord_<exelotl> Hey so, is it ok to have a generic type Foo[T] in Nim, where T is not actually used anywhere in the type definition?
22:45:02FromGitter<mratsim> @dom96 issue fixed ;)
22:45:24FromGitter<mratsim> I agree with disruptek, ugly bug
22:45:53dom96mratsim: <3
22:46:17FromGitter<mratsim> This one is ugly too :/ https://forum.nim-lang.org/t/5124
22:46:26disrupteki'm playing with the code and it's not making a lot of sense to me.
22:46:55FromGitter<mratsim> because he was desperate and added echo everywhere
22:47:01FromGitter<mratsim> the fix is there: https://github.com/pb-cdunn/nim-help/pull/1
22:47:03ldleworkdom96: "based on what I've seen from them so far" is the obvious condescension :P
22:47:04FromGitter<mratsim> 1 LOC
22:47:22FromGitter<mratsim> change ref Db return type to Db and it magically work
22:47:42ldleworkdom96: oh you were talking about the guy in the thread, no disruptek heh total misread there
22:47:45*ldlework jumps out of a window.
22:48:09FromDiscord_<exelotl> Basically I have an object with a byte array inside, where the byte array is cast to a different type depending on the specialisation of the object
22:48:11FromGitter<mratsim> seems like there is a bug when returning a ref type (that was not defined as type Foo = ref object / ref Bar)
22:48:19FromDiscord_<exelotl> like this: https://gist.github.com/exelotl/09c7fb07ae08d97aa9738d63b960bacc
22:49:03FromGitter<mratsim> @exelotl do you have a question?
22:49:33FromDiscord_<exelotl> is it ok to use generics like that?
22:50:02FromGitter<mratsim> yes
22:50:09FromGitter<mratsim> that's how Nim channels are implemented
22:50:16FromDiscord_<exelotl> oh sweet, cool :D
22:50:45FromGitter<mratsim> https://github.com/nim-lang/Nim/blob/devel/lib/system/channels.nim#L39
22:51:53disrupteki'm reading your PR but it doesn't answer any of my questions. o.O
22:52:14FromGitter<mratsim> well I didn't try to understand the code, only the bug :P
22:52:24FromGitter<mratsim> I have no idea what the code is doing :P
22:53:48FromDiscord_<DeltaPHC> What's the difference between `ptr` and `pointer`?
22:54:26disrupteki meant, i don't understand the bug. :-D
22:54:32FromGitter<mratsim> pointer is type erased, ptr needs a type like ptr int32, ptr char or ptr MyContext_t
22:54:50FromDiscord_<DeltaPHC> Ah, I kinda figured it would be something like that
22:54:51FromGitter<mratsim> if you know C, pointer is quivalent to "void *"
22:55:16FromGitter<mratsim> a pointer parameter accepts both pointer and ptr T
22:55:17FromDiscord_<DeltaPHC> But then it seems like you can also use `ptr` like a typeclass, lol
22:55:49FromGitter<mratsim> yes, you can do "when T is ptr or pointer: foo()" if you want
22:56:04FromDiscord_<DeltaPHC> Only slightly confusing, but I get it
22:56:32*lritter quit (Quit: Leaving)
22:56:52*gangstacat joined #nim
22:58:08FromDiscord_<DeltaPHC> So, to sum up:
22:58:08FromDiscord_<DeltaPHC> `ptr T` --> a pointer to T
22:58:08FromDiscord_<DeltaPHC> `ptr` --> a typeclass accepting any `ptr T`
22:58:09FromDiscord_<DeltaPHC> `pointer` --> a physical type kinda like a void pointer in C. Any `ptr` can be implicitly converted to this
22:58:53FromGitter<mratsim> yep
22:59:29FromDiscord_<exelotl> mratsim: what happens with channels if your type is bigger than pbytes.len?
23:00:42FromDiscord_<Shield> I don't quite understand why you need T in Actor*[T] = ptr ActorObj
23:01:22FromGitter<mratsim> it's to more easily convert data
23:01:31FromGitter<mratsim> and to have type checking in the high level API
23:01:47FromDiscord_<exelotl> yeah, that ^
23:02:05FromGitter<mratsim> I expect it crashes with IndexError @exelotl (or worse it truncates)
23:02:53FromGitter<mratsim> also if you really have a lot of data to transfer, you should just copy the pointer to the data and transfer ownership
23:03:16FromGitter<mratsim> but some compiler help would be nice for ownership transfer
23:03:18FromDiscord_<Shield> interesting, didn't know type checking still happens even if you don't use that type within the object
23:03:44FromDiscord_<exelotl> @Shield yeah me neither, that's why I wanted to check here before I settled on this design xD
23:03:44FromDiscord_<DeltaPHC> I'm still pretty new to Nim, but its type system is certainly deeper than my initial impressions. (that's a good thing IMO)
23:07:32FromDiscord_<DeltaPHC> Nim even has const generics. Rust isn't quite there :B
23:11:05FromDiscord_<exelotl> there's one main thing I've struggled with in my Nim GBA efforts so far, which is that Nim doesn't really have a good way to get a pointer to some constant data
23:13:04FromDiscord_<exelotl> since 'const' in Nim is strictly a compile-time constant, and while 'let' is immutable it doesn't lead to consts in the generated C code
23:17:56FromDiscord_<exelotl> I have to work around it by either (a) using `emit` to produce C consts and then importing them back into Nim or (b) importing the C '&' operator and using it with some dangerous assumptions about what will happen when I do &myNimConst
23:26:45*shomodj_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:46:53*krux02 quit (Remote host closed the connection)