<< 13-01-2021 >>

00:03:16disruptekleorize: should testes have a secret "arc tests matter" option?
00:17:33leorizenot sure, depends on how you want your testes to be
00:18:27*hmmm quit (Quit: WeeChat 3.0)
00:19:54*Jesin quit (Remote host closed the connection)
00:20:04*hmmm joined #nim
00:20:07*hmmm quit (Client Quit)
00:21:09*Jesin joined #nim
00:23:46disrupteki want them to reflect the goals of important_packages, but that's pointless while #16447 remains open.
00:23:55disbothttps://github.com/nim-lang/Nim/issues/16447 -- 3testament fails for packages that require $NIMBLE_DIR/bin in PATH ; snippet at 12https://play.nim-lang.org/#ix=2LQ3
00:33:24leorizedisruptek: does `expect(exception)` let me access the exception?
00:49:38disruptekwhat?
00:51:34disruptekyou use it to verify that an exception of the proper type is thrown and may be caught; if you want to catch it yourself, use a try/except block.
00:51:53disruptekyou can reraise with `raise` if it helps.
00:52:32leorizeI want to make sure that it's in the right format
00:52:40leorizethe raise trick sounds like it would do
01:18:51*Tanger joined #nim
01:42:44*Prestige quit (Quit: Prestige)
01:44:27*Prestige joined #nim
02:05:41*lritter quit (Quit: Leaving)
02:20:18disruptekyeah, that should work.
02:25:08leorizedisruptek: not sure if its testes or my tests... https://github.com/alaviss/nim-sys/runs/1692136925?check_suite_focus=true#step:7:16
02:27:46leorizewdyt about making testes re-run failed -d:release tests with -d:release --stacktrace:on just to catch stuff like this
02:28:32leorizeand the most stupid part of this is that only the release build crashes
02:33:44disruptekthat /is/ pretty stupid. we already run a debug build to try to tease out answers to a release/danger crash.
02:34:31disruptekwhy not just use stacktrace:on for all release builds? performance metrics can be measured in danger, right?
02:37:57leorize> proceeds to generate even more bugs on -d:danger
02:38:49disruptekthat error looks exactly like the bug i see sporadically with arc.
02:38:55disruptekbut, only arc.
02:40:20disruptekmaybe it /is/ testes.
02:40:49leorizeI find it weird though
02:41:19leorizewhat kind of bug due to out-of-bound access would only show up on 32 bit Windows, of all things
02:41:38disruptekfor me it was only macos 😆
02:41:59leorizeand it doesn't bug out when you do debug build
02:42:05disruptekat first it seemed like it was only cpp/arc.
02:42:30disruptekso there are some extra code paths for testes in release builds (as a library) because it does the timing stuff.
02:42:39disruptekshould we just do those in danger only?
02:44:50leorizeprobably, if it can pass on release it should pass on danger, right?
02:45:04disruptekyou might think so.
02:45:20disruptekmaybe danger should omit testes' checks, too?
02:45:51disruptekanother possibility is that it's a bug in jc's bytes2human thing.
02:46:15leorizenot that we can find out without a windows computer
02:46:29leorizeI'll borrow one later
02:46:58disruptekeh we can just force it, too.
02:47:25disruptekyou know, any cli args you pass to testes get passed to the compiler.
02:51:41disrupteki don't ever reproduce these defects locally, either.
02:52:06disrupteknot sure what that means. maybe it's not something that happens on linux.
02:52:26leorizepushed a commit that enable stacktrace
02:52:35leorizelet's see what went wrong
02:52:48disruptekso, only timing numbers in danger, right?
02:52:58disruptekima push a patch to testes.
02:53:22disruptekalso this will let us weed out bytes2human from the problem.
02:58:23disruptekgah i should reimpl this bytes2human thing. 🤭
02:58:26leorize[m]looks like stacktrace was the reason why the bug didn't show up...
02:58:38disruptekwhat is it?
02:58:47leorize[m]https://github.com/alaviss/nim-sys/actions/runs/481768307
02:58:51leorize[m]I don't know
02:59:07leorize[m]it passed
02:59:09disruptekis that testes 1.1.2?
02:59:41*Tlangir joined #nim
03:00:08leorize[m]no that's 1.1.1
03:00:09disruptekit's in repr.
03:00:16disruptekfrom testes. 🤦
03:00:24leorize[m]https://github.com/alaviss/nim-sys/runs/1692434924?check_suite_focus=true#step:6:12
03:00:36*Tanger quit (Ping timeout: 240 seconds)
03:01:01leorize[m]oh lol
03:01:14disruptekthat is /so/ not the same IndexDefect though.
03:02:08leorize[m]you fixed it now? so I can try to re-run the branch
03:02:59disruptek1.1.2 is just tweaked to have stacktrace on release and some other shit.
03:03:08disruptekdo you have push on testes?
03:03:38disrupteksent invite.
03:04:36FromDiscord<shadow.> where's the best guide on ffi? starting from ground 0, but with some knowledge of c / c++
03:04:58FromDiscord<shadow.> im guessing nim in action is a good place to start?
03:05:08disruptekdunno.
03:05:25disrupteki had to learn a thing to make an OBS module.
03:05:48disruptekby which i mean i had to ask araq about something.
03:05:54disruptekotherwise, i think i just rtfm.
03:06:24disruptekit's pretty damned easy, honestly.
03:07:15disruptek~kaushalmodi
03:07:16disbotkaushalmodi: 11a badass coder with a wealth of useful Nim articles on his blog, at https://scripter.co/ -- disruptek
03:07:33disruptekprobably has done some of the most complex ffi stuff.
03:08:57disruptekleorize: but is that your bug? that shows up on linux, too.
03:22:11*muffindrake quit (Ping timeout: 272 seconds)
03:23:28*muffindrake joined #nim
03:34:33*Tlanger joined #nim
03:34:46*adnan338 joined #nim
03:36:28*Tlanger is now known as Tanger
03:36:31adnan338Hello I am parsing a large file. For convenience, I want to set the read cursor to update every time I call writeLine. For example, if I set up a stream from a file, if I call readLine once, next time when I call readLine, it should start from the second line. Is there any such API?
03:37:00*Tlangir quit (Ping timeout: 256 seconds)
03:37:50FromDiscord<shadow.> isnt that default
03:38:16FromDiscord<Rika> its what it should do yes
03:38:19FromDiscord<shadow.> for open(string, fmRead) or whatever
03:38:28FromDiscord<shadow.> then just .readLine()
03:38:30FromDiscord<ElegantBeef> yea `readline` will capture the next line until `\n`
03:38:35FromDiscord<shadow.> ye
03:38:39FromDiscord<ElegantBeef> Or a newline character
03:38:48FromDiscord<shadow.> prolly \p idk
03:38:53adnan338https://nim-lang.org/docs/io.html#readLine%2CFile didn't seem to mention that. thank you.
03:39:05FromDiscord<shadow.> 👍
03:39:20*waleee-cl quit (Quit: Connection closed for inactivity)
03:47:03*abm quit (Read error: Connection reset by peer)
04:08:05FromDiscord<William_CTO> sent a code paste, see https://play.nim-lang.org/#ix=2LRd
04:19:13adnan338Noticed that there's no parseInt64(). How do I go about parsing a string to int64? (instead of doing it manually)
04:20:40*sagax quit (Quit: Konversation terminated!)
04:21:47FromDiscord<Rika> parseBiggestInt
04:22:12FromDiscord<Rika> note that there isnt a parseInt32 either
04:22:13*spiderstew_ joined #nim
04:23:01*spiderstew quit (Ping timeout: 264 seconds)
04:23:13disruptekhaxscramper: you up?
04:24:56*bacterio quit (Ping timeout: 240 seconds)
04:47:01*bacterio joined #nim
04:48:05disruptekhaxscramper: anyway; a good reason to use nimph: i could install your package as a dependency (`nimph doctor`), roll it backwards to try an earlier version (`nimph downgrade`), look at the git history to see if there was any version that would work (cd `nimph path hmisc`; tig), `nimph fork` your repo, make my changes, push them, and use hub to open a PR from the cli.
05:02:36*bacterio quit (Ping timeout: 240 seconds)
05:22:02*bacterio joined #nim
05:33:24*WilhelmVonWeiner quit (K-Lined)
05:42:50adnan338Hi, could anybody help me understand the error here? https://play.nim-lang.org/#ix=2LRt
06:05:07saemquick look, I think what's going on is that you created a var OrderedTable, then tried to assign it to a non var field
06:05:15saemrather it's not a gc tracked ref
06:06:05FromDiscord<Rika> it should just copy tho right?
06:06:18saemI guess so, but when I rearrange the code it works
06:06:33disruptekit's a compiler bug.
06:08:40FromDiscord<flywind> It works with `--gc:arc`.
06:09:10adnan338Oh, arc fixes it
06:09:19adnan338Weird error
06:09:47disruptekbeginner's luck.
06:12:31adnan338Is it possible to describe --gc:arc and --threads:on in the project .nimble file, so a user doesn't have to manually set these flags?
06:13:02disruptekplease use a .cfg file named project.nim.cfg where project is the name of your program's entry point.
06:13:14disruptek~disrupstyle
06:13:16disbotdisrupstyle: 11tips for writing code that won't provoke 😠 rants 🤬 on irc: https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d -- disruptek
06:20:53*habamax joined #nim
06:25:06*NimBot joined #nim
06:33:43*Jjp137 quit (Read error: No route to host)
06:34:16*Jjp137 joined #nim
06:45:46*narimiran joined #nim
06:50:03*krux02 joined #nim
06:51:39FromDiscord<Ardek> stylish
06:53:43*my_dude joined #nim
06:57:25*my_dude quit (Client Quit)
07:05:54FromDiscord<GreenFork> disruptek, "where project is the name of your program's entry point." what if I don't have a specific "entry point", it's just a set of files? is this recommendation still same when I need to put it into directory like tests/ ?
07:07:49disruptekyou can always use a nim.cfg, but at the root of your project, you don't want to commit it.
07:08:01disruptekin your tests directory, you can use nim.cfg.
07:08:09disruptekyou can commit it there, if you must.
07:08:35disruptekthe point is that the package manager should be able to blow away the .cfg in your project on every alternate site where the project is installed.
07:09:07disruptekeach of these sentences has some amount of ambiguity. i hope you can parse it out.
07:09:59FromDiscord<GreenFork> yeah, that makes sense, thanks
07:10:01FromGitter<gogolxdong> Made a workaround of createAsyncPipe to migrate to --gc:arc, everything works fine by far, and I won't care possible memory leak unless it crashes too soon.
07:10:04disruptekcool.
07:34:01*bacterio quit (Ping timeout: 246 seconds)
07:39:16*bacterio joined #nim
08:02:31FromDiscord<mattrb> I was being stupid the other day and couldn't seem to get staticFor to work. All good now and working as intended! Thanks again for the help 🙂
08:32:36*fputs quit (Ping timeout: 240 seconds)
08:40:46*u0_a2161 joined #nim
08:42:23*hoijui joined #nim
08:44:50*Clonkk[m] joined #nim
08:48:30*Tanger quit (Remote host closed the connection)
09:30:31*Tanger joined #nim
09:31:37*Torro joined #nim
09:42:39*sagax joined #nim
09:45:49*u0_a2161 quit (Ping timeout: 264 seconds)
09:49:35FromGitter<gogolxdong> Does https://github.com/snej/nimdbx support windows?
09:51:15FromDiscord<ElegantBeef> https://github.com/snej/nimdbx/issues/4 possibly?
09:51:16disbotCI failure on Windows, libmdbx doesn't build in Github Actions
09:58:13*piron_ quit (Ping timeout: 246 seconds)
09:58:38*vicfred quit (Quit: Leaving)
10:00:41*piron joined #nim
10:02:52adnan338Ok my hobby project is coming along nicely. Now comes the part where I start shipping it with Flatpak. But I noticed that installing nimph is still giving me issues :(
10:12:09*haxscramper joined #nim
10:13:42giacois there any nim module that would help me mapping the settings of my application with a web panel, beside jester?
10:17:33*Q-Master quit (Ping timeout: 260 seconds)
10:18:25haxscramper`--panics:on` makes `raiseAssert` a side effect - is this an expected behavior and if so, what are recomended ways of fixing this? I would prefer to leave `.noSideEffect.` annotation when possible, because I raise assertions in a lot of places, and converting all of them to `proc` would be quite tedious process.
10:20:18*xace quit (Ping timeout: 272 seconds)
10:25:12FromDiscord<GreenFork> haxscramper, you can probably wrap all raiseAssert into {.cast(noSideEffect).} https://nim-lang.org/docs/manual.html#pragmas-nosideeffect-pragma but not sure if it is less tedious
10:26:11FromDiscord<GreenFork> maybe defining a new wrapper with `cast` around single raiseAssert proc is okay too. then just rename every raiseAssert to newly defined func
10:28:08*hnOsmium0001 quit (Quit: Connection closed for inactivity)
10:33:09*xace joined #nim
10:34:57*PMunch joined #nim
10:39:01*xace quit (Read error: Connection reset by peer)
10:39:03haxscramperI'm more concerned with how 'idiomatic' this apporach is - if I understand correctly `--panics:on` makes it possible for a compiler to convert `raiseaAssert()` into program termination (because assertion error is a defect)
10:39:48haxscramperI'm using assertions to show that something went wrong, but maybe I should derive my own exception from `CatchableError` and use it everywhere?
10:40:42haxscramper`.cast(noSideEffect).` is a possibility, yes, but doing this systematically is a clear sign of using language feature wrong
10:43:56haxscramperBut maybe using custom exception is also bad, because `raiseAssert` is *exactly* the thing I need, and reimplementing it in different way only to mitigate compilation errors might mean I'm sacrificing something else
10:46:59*Q-Master joined #nim
10:51:16*Q-Master quit (Ping timeout: 240 seconds)
10:56:11Oddmongerholy sh*t , we can declare objects not defined :(
10:56:53Oddmongervar world:World didn't raise any error (i could even use it as a parameter for a function) until i've tried to access its members
10:57:32haxscramper!eval var world: World
10:57:34NimBotCompile failed: /usercode/in.nim(1, 12) Error: undeclared identifier: 'World'
11:00:01Oddmongeri think it's because it's defined in a submodule (with an include)
11:00:05Oddmongermy bad
11:02:53*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
11:03:40*pbb joined #nim
11:04:56Araqhaxscramper, if they are Catchable, don't use 'assert'
11:08:12haxscramperAraq: you mean 'if I expect user to be able to catch them'? E.g. assert is a defect, so in the end I'd better derive custom exception
11:08:17haxscramperAnd use it instead?
11:24:41*Vladar joined #nim
11:26:06*Q-Master joined #nim
11:35:13*xace joined #nim
11:45:17*abm joined #nim
11:55:38Araqyes
11:56:38*Vladar quit (Quit: Leaving)
12:18:38FromDiscord<tomck> Any way to access private fields?
12:18:53FromDiscord<tomck> found this; https://github.com/nim-lang/Nim/pull/11865 but it's not merged yet
12:18:56disbot`import foo {.all.}` ; snippet at 12https://play.nim-lang.org/#ix=2iAE
12:19:27PMunch@tomck, you can always include instead of import
12:19:31FromDiscord<tomck> any good way to just say 'fuck it let me get this value'? debugging some c ffi stuff
12:19:35PMunchWith all the caveats that has
12:19:35FromDiscord<tomck> won't that break everything?
12:19:55PMunchWell you can "include" in a separate file and write exporters
12:19:55FromDiscord<tomck> can confirm it breaks everything
12:23:55FromDiscord<tomck> eh?
12:23:58FromDiscord<tomck> how does that work
12:24:57PMunchBasically you extend the module
12:25:20PMunchBut it does become a new module, so if you import both the old and the new then you will have trouble
12:25:58FromDiscord<shadow.> if i have a c++ library that basically just acts as all headers to a `.lib` file, can i still ffi that in nim or na
12:26:57FromDiscord<tomck> yeah the module's imported everywhere, it's from a different library
12:27:01FromDiscord<tomck> i'll just do some pointer bullshit
12:28:02PMunch@shadow, sure
12:53:39FromDiscord<shadow.> hmm ok
12:59:11*Vladar joined #nim
14:01:16*Jehan_ joined #nim
14:08:58*Jehan_ quit (Quit: Leaving)
14:20:13*cgfuh joined #nim
14:24:11FromDiscord<apollo> not sure if i've asked this before but how can i make nim work in neovim?
14:28:27PMunchHmm, I've started getting "could not import: BIO_new_mem_buf" with the new ssl libraries in windeps.zip
14:28:37FromDiscord<Rika> there is a plugin `nim.nvim`
14:33:57FromDiscord<flywind> !eval static: echo "1234"↵import sets↵static: echo "3456"
14:33:58NimBotCompile failed: /usercode/in.nim(1, 20) Error: undeclared identifier: '↵import'
14:34:04FromDiscord<apollo> thank you is it available on github?
14:34:31*fputs joined #nim
14:34:45FromDiscord<flywind> dots are very annoying
14:35:06FromDiscord<flywind> sent a code paste, see https://paste.rs/UUk
14:35:23FromDiscord<flywind> sent a code paste, see https://paste.rs/BKl
14:36:22FromDiscord<flywind> which are keeping causing problems.
14:36:27PMunchAraq, the ssl/crypto DLLs in windeps.zip are not the same as the ones in dlls.zip and they don't work with the SSL wrapper in Nim
14:37:04FromDiscord<flywind> https://play.nim-lang.org/#ix=2LU4
14:37:08PMunchI get the error "could not import: BIO_new_mem_buf" which in the SSL wrapper is said to be in the SSL dll but it is in the crypto DLL
14:39:08FromDiscord<flywind> https://github.com/nim-lang/Nim/pull/16648/files
14:39:08disbotrevive PR #16320 (CRLF fix); fix #16308; Update openssl.nim
14:39:18FromDiscord<flywind> could this PR solve your problem?
14:39:36FromDiscord<flywind> @PMunch
14:40:16PMunchThat would indeed fix it
14:42:59FromDiscord<flywind> I file a new issue: https://github.com/nim-lang/Nim/issues/16707
14:57:53*Tanger quit (Quit: Leaving)
15:03:04AraqPMunch, huh...
15:03:16FromDiscord<notchris> Morning friends!
15:05:17PMunchApparently the PR @flywind sent would work, but it's still a bit odd
15:06:18*habamax quit (Ping timeout: 260 seconds)
15:09:56Oddmongerif i have an object defined like this: Rect(x,y,w,h:int) , can i fill the w,h part with a tuple returned by a function ?
15:10:07Oddmongerwithout using intermediate values
15:10:28Oddmongermy function is returning (x,y)
15:11:03Oddmongerso i thought i could write: (rect.x,rect.y) = myfunction(…)
15:12:43*tane joined #nim
15:14:10Oddmongerah i've made a template, may transforming it to function would help debugging
15:19:41Araqso ... they replaced Rick with his 10 year old daughter?!
15:20:18Araqmost ridiculous, why would I watch this...
15:20:37FromDiscord<dk> What does `!` do in karaxdsl?
15:21:16mipriOddmonger: you can define `xy=` to get rect.xy = myfunction(...)
15:21:48Oddmongerah yes good idea
15:25:19disruptekadnan338: run nimph's bootstrap.sh or bootstrap-nonimble.sh; your nimble is already too confused to be able to install nimph itself.
15:32:01*joast quit (Quit: Leaving.)
15:36:32disruptek~gitnim
15:36:33disbotgitnim: 11https://gitnim.com/ -- choosenim for choosey nimions -- disruptek
15:36:57disruptekif anyone is on linux and wants to test gitnim+dist, please tell me what sucks.
15:38:37FromDiscord<andeee> If anyone is interested in writing native extensions to node js, I've made a library for making them in Nim https://github.com/andi23rosca/napi-nim
15:38:55*fputs quit (Ping timeout: 256 seconds)
15:40:52*fputs joined #nim
15:41:37ForumUpdaterBotNew thread by Vinyll: Admin for web app, see https://forum.nim-lang.org/t/7380
15:55:10haxscramperdisruptek: I pushed new hmisc version with 'some' fixes, it should now correctly work with panics
15:55:24disrupteknice, thanks.
15:55:29haxscramperBecause I was so stupid and just used `asert` everywhere
15:55:50disrupteki wasn't sure how you'd want to solve it...
15:56:05haxscramperWell, neither was I at the start
15:56:37haxscramperI'm still not sure that is the right approach - see https://irclogs.nim-lang.org/13-01-2021.html#10:18:25
15:57:18haxscramperBut I think that 4raq's solution is probably the best option, so I decided to go with it
15:57:41*anthonyy joined #nim
15:58:56*anthonyy quit (Client Quit)
15:59:41*anthonyy joined #nim
16:04:41*waleee-cl joined #nim
16:08:55ForumUpdaterBotNew question by Alex Craft: How to cache value of a function with different arguments in Nim, see https://stackoverflow.com/questions/65705598/how-to-cache-value-of-a-function-with-different-arguments-in-nim
16:41:22*hoijui quit (Ping timeout: 260 seconds)
16:44:00*a_chou joined #nim
16:47:50*Torro quit (Quit: bye)
16:50:14haxscramperIs there a separate list of various papers used for compiler implementation - I found one in documentation control flow graph `dfa.nim` ("A Graph–Free Approach to Data–Flow Analysis"), but maybe there is something else (aside from several datastructure and memory/allocation-related)?
16:55:09Araqhaxscramper, no but I read the Dragon book, Wirth's compiler construction and Modern Compiler Implementation in ML when I started
16:58:16Zoom[m]Araq: how {en,dis}couraged is using Options in potential std|fusion code? It's not used much ATM.
16:59:35*hoijui joined #nim
16:59:43*hnOsmium0001 joined #nim
17:00:09*hoijui quit (Remote host closed the connection)
17:03:20AraqI don't like Options and prevend them when I can. But I'm pretty lonely
17:03:27Araq*prevent
17:03:45ForumUpdaterBotNew thread by Chaemon: MemberProc macro, see https://forum.nim-lang.org/t/7381
17:04:40FromDiscord<Rika> why dont you like options?
17:04:56Araqfor me Option[T] is usually better done via an exception. Yeah, yeah, so sue me I don't like manual error propagation until the applayer can finally say 'quit "Error"'
17:05:47disruptekthere are so many cases where an option is the right abstraction: if it's there, give it to me; else, don't.
17:06:36haxscramperI think options should be acceptable closer to leafs of the calltree (like when you have something like `parseInt()` or something, and encouraged for arguments and fields
17:06:57haxscramperE.g. when `None()` means something
17:07:06haxscramperOr when you don't have enough context anyway
17:07:11disrupteki've never used an option in an argument.
17:07:23haxscramperWell, yes, it is a questionable thing to do
17:09:31haxscramperSo field values, //maybe// arguments (only because it doesn't matter that much), and return value only close to calltree leaves
17:11:38disrupteki guess it composes a little more easily for arguments; i wonder if the runtime cost is negligible.
17:12:46haxscramperFor arguments - I think explitly using `Option[string] = none(string)` is better than some magic value (like empty string, negative integer and so on)
17:13:03disruptekthat's what i'm saying.
17:13:08FromDiscord<dk> Any clue what this error by ormin could mean: `ormin/queries.nim(146, 17) Error: undeclared identifier: 'datetimeType'`?
17:13:26disruptekalso, it's easier to foment an option in unrelated code prior to passing it to the call.
17:14:13disruptekhaxscramper: was my description of nimph workflow compelling?
17:14:32*PMunch quit (Quit: leaving)
17:15:22haxscramperyes
17:16:09disruptekwhen nimph was created, there was no nimbledeps (local deps) support.
17:16:44*Jesin quit (Ping timeout: 256 seconds)
17:16:53FromDiscord<dk> Examples use timestamp instead so I guess I'll just use timestamps instead of datetimes 🥴
17:17:01disruptekit doesn't just let you use local deps, it lets you perform your work in them, too.
17:17:38disruptekso if you need to update a dependency that you do or don't maintain, you can do that work in-situ without affecting other projects.
17:17:44disruptektest it in place, etc.
17:18:23disruptekwhen it works, cut a new version, release it, and move on. nimph will pick it up in other projects as necessary, etc.
17:24:01haxscramperWell, to be honest the only reason I haven't switched to it yet, is because I'm working with what is basically monorepo with almost no external dependencies (I think only cligen and several similar libraries). But considering just how /annoying/ some things are it is only a matter of time
17:24:29haxscramperI will certainly do this when I get to it when writing dist support for docgen
17:26:26FromDiscord<rinfz> whats the equivalent of the python `xs[1:]`? and are all the indexing/slicing methods documented anywhere?
17:26:37haxscramper`[1..^1]`
17:26:45disruptekscramper: i do a lot of `--nimblePath="$config/deps/pkgs/"` and then `--path="$config/../foo"`; it's easy to mix and match local deps where it makes sense.
17:28:05disruptekjust running `nimph` and seeing which versions of stuff my code is pulling in is hard to live without.
17:28:08FromDiscord<rinfz> thanks
17:33:46*a_chou quit (Quit: a_chou)
17:39:57*fputs quit (Quit: WeeChat 3.0)
17:45:44leorize[m]disruptek: you manage to reproduce it on linux?
17:45:59disruptekremind me...
17:46:35leorize[m]testes dying on release build but not debug
17:47:03disruptekyes. your ci demonstrate it on linux.
17:47:22leorize[m]huh? my ci passes for linux?
17:47:33disruptekbut, re-run it. i made a lot of testes changes tracking down these issues.
17:47:40leorize[m]except arc but that's just arc being shit
17:48:08leorize[m]sure
17:48:16disruptekyes; testes won't trigger that arc bug now.
17:49:20leorize[m]got any projects doing parsing that you would like to see fuzzed? I'm thinking of looking into fuzz testing Nim software
17:50:01disruptekthat might be a really neat way to improve dust.
17:50:42leorize[m]if it imports the compiler I would hold that off a bit
17:51:19leorize[m]the compiler already crashes by just using it so I'm not sure if fuzzing it gets you anywhere :p
17:51:20disrupteknot sure what else would be relevant.
17:51:38disrupteki only parse using npeg these days.
17:52:26disruptek!repo gully
17:52:27disbothttps://github.com/disruptek/gully -- 9gully: 11a code comment formatter 15 3⭐ 0🍴
17:52:30leorizemaybe I can try fuzzing nim-regex
17:52:31disruptekwhat do you think of this project?
17:53:19disruptekfor that matter, nimsuggest still crashes often enough that it's probably a better place to invest time.
17:54:16leorizelooks neat
17:54:56disruptekit doesn't work, but there are a lot of bones.
17:55:29disrupteki got bored after building the structure, basically.
17:55:33leorizeI'm holding off looking into nimsuggest since 4raq's IC is gonna rip out all the hacks nimsuggest use to speed itself up
17:56:45leorizeeither IC will fix all nimsuggest bugs or it would just replace one set of bugs with another
17:57:10disruptekwill you mess with gitnim for me?
17:57:40leorizelater, I want nim-sys to work first
17:57:48disruptekfair enough.
18:13:44*koltrast quit (Ping timeout: 246 seconds)
18:33:53*Jesin joined #nim
18:44:45Araqhmm I'm loading an ID that never was created...
18:45:00*NimBot joined #nim
18:45:16Araqand the ID is 0
18:53:54*lritter joined #nim
18:53:58ForumUpdaterBotNew thread by Alexeypetrushin: How to understand nimprof report?, see https://forum.nim-lang.org/t/7382
18:54:05*koltrast joined #nim
19:01:31*Vladar quit (Remote host closed the connection)
19:03:40*Vladar joined #nim
19:10:22FromGitter<StefanSalewski> That is really funny: https://github.com/StefanSalewski/gintro/issues/108#issuecomment-759657050
19:10:29disbotGstreamer, appsink element new-sample signal seems missing ; snippet at 12https://play.nim-lang.org/#ix=2LW2
19:11:51disruptekuse -d:useMalloc
19:12:33FromGitter<StefanSalewski> Ah yes, forgot about -d:usemalloc. will test, thanks.
19:15:06*vicfred joined #nim
19:15:35FromGitter<StefanSalewski> No, -d:useMalloc does not really help. Get a crash after 5 tests. But will test with -d:useMalloc and valgrind now.
19:16:52*xet7 quit (Quit: Leaving)
19:16:55FromGitter<StefanSalewski> nim c --gc:arc -d:useMalloc -d:danger appsink_src.nim
19:17:10FromGitter<StefanSalewski> ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
19:17:23FromGitter<StefanSalewski> So all is fine with -d:danger
19:18:42*xet7 joined #nim
19:18:54*xet7 quit (Remote host closed the connection)
19:21:30FromGitter<StefanSalewski> Well I don't know much about gstreamer, I wrote this example for Mr. arkanoid87. Conversion from C example.
19:21:36FromGitter<StefanSalewski> Bye.
19:23:06*xet7 joined #nim
19:34:46*cadmium[m] joined #nim
19:36:45*hmmm joined #nim
19:37:11hmmmhay beautifuls
19:37:16hmmmback to some nim!
19:37:28hmmmhow do I tokenize word/sentences in nim?
19:37:49haxscramperhttps://narimiran.github.io/2021/01/11/nim-parsing.html
19:38:02haxscramperOr for simple things just `strutuils.split()`
19:38:15hmmmour boi nami is a true scholar
19:38:22hmmmI'll look into the blog
19:40:00leorize[m]Nim performs memory allocation within the default signal handers 🤦‍♂️
19:40:04FromGitter<StefanSalewski> iterator tokenize in strutils.
19:40:13leorize[m]well luckily we always crash after a signal
19:40:16FromDiscord<Meowz> sent a code paste, see https://play.nim-lang.org/#ix=2LWf
19:41:06FromDiscord<Meowz> Anything wrong with that if I want to read a sequence of a specific type on a internal process?
19:47:28FromGitter<StefanSalewski> Logout
19:59:36FromGitter<StefanSalewski> With nim c --opt:speed appsink_src.nim it works fine too!
19:59:52FromGitter<StefanSalewski> So it is not a real Nim issue.
20:00:39FromGitter<StefanSalewski> So I guess memory corruption when gcc does not optimize. Will be some work to debug.
20:04:56FromDiscord<~leoi> Hello everybody! I was trying to figure out how to iterate over multiple tuples at once, to implement a Vector add function
20:05:33FromDiscord<~leoi> but tuples only accept indexes that can be evaluated at compile time
20:06:08FromDiscord<~leoi> should I just use arrays of size 3 instead? or is there a nicier solution?
20:06:18mipriI'd go with the arrays, yeah
20:08:06mipriif you want to see if what you're trying to do is possible though, try showing your attempt
20:08:08*vicfred quit (Read error: Connection reset by peer)
20:09:26*Kaivo joined #nim
20:10:51hmmmjeez
20:11:01hmmmwho decided that defer can't work at top level
20:11:20*l1x joined #nim
20:13:08FromDiscord<InventorMatt> @~leoi if you want to statically unroll the loop so it can work you can do this https://play.nim-lang.org/#ix=2LWu
20:16:28leorizehmmm: it's like that for good reasons
20:19:19hmmmhmm I think the powers at the top are just oppressing us defer users
20:19:36hmmmbut ok I'll .close my file like a good boy
20:20:40FromGitter<StefanSalewski> May it be a problem when echo is executed from within a different thread?
20:22:23leorizehmmm: it's mainly because "top-level" has special semantics
20:22:38FromGitter<StefanSalewski> I have replaced g_print() with echo(), and assume that gstreamer is using multiple threads.
20:24:01leorize@StefanSalewski no, currently we use the C library to do IO, which is thread-safe
20:24:45FromGitter<StefanSalewski> At least increasing the number of echo statements seems to increase the chance for a crash.
20:25:24FromGitter<StefanSalewski> Without many echo() I can not get a crash when executed by valgrind.
20:25:35leorizeecho do use the GC though
20:26:07leorizeif you're not using ARC/ORC and your code is in a foreign (non-Nim) thread, you need to setup the GC
20:26:41FromGitter<StefanSalewski> Yes, good point. But refc, arc, orc and none makes not a very big difference.
20:26:41leorizethe function is called `setupForeignThreadGc()` iirc
20:27:12leorizewas the nim code compiled with --threads:on?
20:27:26leorizethe memory allocator does not employ locks unless threads are enabled
20:27:26FromGitter<StefanSalewski> No.
20:27:48FromGitter<StefanSalewski> Will try --threads:on, thanks.
20:30:39FromGitter<StefanSalewski> nim c --threads:on appsink_src.nim gives nice valgrind errors, fine. That may help by debugging.
20:30:54FromGitter<StefanSalewski> Will continue tomorrow, bye.
20:30:57FromGitter<StefanSalewski> Logout
20:43:59FromDiscord<~leoi> Thanks man, that is exactly what I was thinking about. Before trying macros I was tweaking an iterator to see if it worked, but it didn't (iterators generate code at compile time, don't they?)
20:44:46FromDiscord<tomck> sent a code paste, see https://play.nim-lang.org/#ix=2LWD
20:46:46FromDiscord<InventorMatt> I don't believe they do. although my implementation isn't the best it should probably be rewritten as a forloop macro
20:47:59FromDiscord<haxscramper> Iterators inline code during compilation, but that is an implementation detail
20:50:27FromDiscord<haxscramper> IIRC that is how it should work technically, see for example https://github.com/haxscramper/hax-nim/blob/master/hack-test/static_when_type.nim
20:50:32FromDiscord<haxscramper> But this is a road to madness
20:51:00*narimiran quit (Ping timeout: 256 seconds)
20:51:15disruptekopengl here?
20:51:25FromGitter<StefanSalewski> Maybe leorize has solved the problem.
20:51:29FromGitter<StefanSalewski> nim c --threads:on --gc:arc -d:useMalloc appsink_src.nim
20:51:35FromDiscord<haxscramper> At least that's what I remember from the time I tried to do something with `static` and generics and `when` with types
20:51:41FromDiscord<haxscramper> !repo gram
20:51:42disbothttps://github.com/disruptek/gram -- 9gram: 11generic graphs in Nim 🕸 15 13⭐ 1🍴 7& 4 more...
20:51:49FromGitter<StefanSalewski> seems to work fine. Not one crash for 50 tests.
20:51:55FromDiscord<haxscramper> Also has some use of `static` if you are interested
20:52:49FromDiscord<haxscramper> @tomck Everything but first message was for your question
20:53:47FromDiscord<tomck> @haxscramper hmm thanks, maybe it just doesn't work with static[int] and static[bool]
20:54:11FromDiscord<tomck> (I also tried `dynamic: static[bool]` as a type param, that didn't work, same error)
20:54:27FromDiscord<tomck> hmmm how tf is it working for a set but not a bool
20:55:36FromDiscord<haxscramper> I'm curious if it is possible to do something like `case kind: static[int]` or similar
20:58:00FromDiscord<tomck> nope, `selector must be of an ordinal type, float`
21:07:34FromDiscord<Mango> :PikaPika:
21:10:09*anthonyy quit (Remote host closed the connection)
21:11:21leorize@tomck iirc arraymancer do this kind of static specialization, maybe you can take a look there?
21:14:35FromDiscord<tomck> wait, i only get the error if i'm instantiating the type in a separate module
21:14:42FromDiscord<tomck> leorize: i'll take a look, thanks
21:25:06FromDiscord<tomck> Ok i figured it out
21:25:14FromDiscord<tomck> https://play.nim-lang.org/#ix=2LWN
21:25:24FromDiscord<tomck> I can have a `when` inside an object just find
21:25:39FromDiscord<tomck> BUT, when I have a proc that takes a `var Grid[...]`, then it shits the bed for whatever reason
21:26:19FromDiscord<tomck> I'm guessing because for whatever reason the types don't unify anymore, so it doesn't recognise that `Flags` should be `{isSingle}`
21:26:42FromDiscord<tomck> I'm pretty sure this is a compiler bug (?), should I add this to the github issues?
21:27:01disruptekjust pr a fix; it's fine.
21:27:08*Etothepiiminus1 joined #nim
21:29:00FromDiscord<tomck> lol ok, it's on my todo list
21:31:27*abm quit (Read error: Connection reset by peer)
21:33:45FromDiscord<haxscramper> Also see https://irclogs.nim-lang.org/05-11-2020.html#22:27:17
21:34:34*Etothepiiminus1 quit (Remote host closed the connection)
21:36:40FromDiscord<tomck> lol
21:37:03FromDiscord<tomck> Stuff like generics always feels like there should be a really nice, easy solution - like a 20 line recursive function & it all just works, boom
21:37:28FromDiscord<tomck> but then you're 4 weeks of work deep & nothing works at all
21:37:33disrupteki didn't even look at the code.
21:38:11FromDiscord<tomck> is nim a context sensitive grammar? I feel like there has to be some weird requirement on the parser what with UFCS & all the compile time stuff
21:38:27FromDiscord<haxscramper> No, grammar is not context sensetive IIRC
21:38:48FromDiscord<haxscramper> Well, indentation /could/ be considered one, because you might need context-sensetive lexer
21:38:53FromDiscord<haxscramper> ~manual
21:38:53disbotmanual: 11the Nim Manual is https://nim-lang.org/docs/manual.html
21:38:53disbotmanual: 11just good to Ctrl+F in cases like this -- haxscramper
21:39:09FromDiscord<haxscramper> Has BNF grammar specifiaction at the start if you are interested
21:40:03FromDiscord<tomck> ta
21:53:54FromDiscord<Mango> sent a code paste, see https://play.nim-lang.org/#ix=2LWZ
21:54:15FromDiscord<dom96> it looks like it succeeded
21:54:32FromDiscord<Mango> How can I fix it?
21:58:34*vicfred joined #nim
22:05:43*krux02 quit (Quit: Leaving)
22:10:48*abm joined #nim
22:11:03*zahary joined #nim
22:17:38*haxscramper quit (Remote host closed the connection)
22:18:04FromDiscord<rinfz> anyone tried using the nim github action nim-lang-alpine? nimble is whining at me that there are no packages
22:31:32FromDiscord<rinfz> never mind i figured it out
22:34:13*xace quit (Ping timeout: 246 seconds)
22:34:16*xace_ joined #nim
22:34:42FromDiscord<Mango> nimble↵-bash: nimble: command not found
22:36:40*xace_ quit (Client Quit)
22:42:20*xace joined #nim
22:42:50FromDiscord<bark> add /root/nim-1.4.2/bin/ to your path?
22:43:05FromDiscord<bark> also idk if this is part of choosenim or whatnot
22:43:10FromDiscord<Mango> How should this work on Linux? ^^
22:44:01FromDiscord<bark> add the line `PATH=$PATH":/root/nim-1.4.2/bin"` to your .bashrc in your home dir
22:44:16FromDiscord<Mango> I'll try
22:44:23FromDiscord<bark> then type `source ~/.bashrc`
22:44:48FromDiscord<bark> but did you compile nimble from source
22:44:57FromDiscord<bark> or is it part of something like choosenim
22:45:06FromDiscord<Mango> I tried to install it from koch
22:45:25FromDiscord<bark> oh okay i was just wondering why put it in such a specific dir
22:45:29leorizeif you're on debian enable backports and install nim from apt
22:45:51FromDiscord<Mango> That is because I downloaded the tarball
22:46:23FromDiscord<bark> oh i completely forgot
22:46:30FromDiscord<bark> you also need the line export PATH
22:46:42FromDiscord<bark> below the path setting
22:47:04FromDiscord<dom96> have you tried just using choosenim? It tells you how to do these PATH changes
22:47:12leorizejust install Nim via apt-get, it works very well for Debian
22:47:28FromDiscord<Mango> Uhh, thanks! That worked!
22:47:43leorizefederico3 keeps them up-to-date at all time and even make sure that tests passes
22:47:58FromDiscord<Mango> I just had to add the folder to Path
22:48:13FromDiscord<bark> well the compilation did succeed
22:48:20FromDiscord<bark> ^
22:49:03*bacterio quit (Quit: bacterio)
22:49:23FromDiscord<bark> but if you just type a command in bash, it will only look for matching executables (any file with execute permission) in directories in the PATH environment variable
22:49:38FromDiscord<bark> which is a list of paths to directories split by :
22:50:23FromDiscord<bark> idk maybe you already know this
22:50:33FromDiscord<bark> im just explaining why i said everything
22:51:01leorizedisruptek: my nim-sys passes now :D thanks for the fix
22:51:03FromDiscord<bark> but it's probably indeed easier to use some more automated solution be it apt or choosenim
22:57:33*hmmm quit (Quit: WeeChat 3.0)
23:01:09*tane quit (Quit: Leaving)
23:17:53FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2LXk
23:18:21FromDiscord<Anonymous Poet> @dom96 ^
23:19:18FromDiscord<Anonymous Poet> I thought maybe the template was doing something funny, but it seems to work fine if the code is only called once. I tried using a macro instead of a template, still doesnt work. Then I tried getting rid of the template and copy-pasting the code for each test. It works fine as long as only one test is not commented out ...
23:19:39FromDiscord<Anonymous Poet> I dont understand why replacing the `asyncCheck` with `discard` makes everything Just Work TM
23:20:32disruptekleorize: nice.
23:21:08FromDiscord<dom96> @Anonymous Poet because by using `discard` you are discarding the exception 🙂
23:21:20FromDiscord<Anonymous Poet> ooooh
23:21:22FromDiscord<dom96> The exception still happens, you just don't see it
23:21:52FromDiscord<Anonymous Poet> i didnt realize it worked that way ... i thought i was discarding the future, which i was fine with because i didnt need
23:22:03FromDiscord<dom96> the future contains the exception
23:22:04FromDiscord<Anonymous Poet> that seems like ... not obvious behaviour?
23:22:18*piron quit (Ping timeout: 256 seconds)
23:22:45FromDiscord<Anonymous Poet> but ok, setting that aside, how do i fix the actual issue, which is the exception itself?
23:23:29FromDiscord<dom96> Can you paste the stack trace? (possibly in a pastebin/gist to not spam this channel)
23:25:26FromDiscord<Anonymous Poet> https://pastebin.com/L5cUpnEQ
23:26:51FromDiscord<Anonymous Poet> sorry for the highlighting, i saw the option and i was like "Nim, please!" and i was happy they had the option so i didnt stop to think that i was pasting a trace and not code... oh well
23:28:01FromDiscord<dom96> I guess line 61 is the `serve`?
23:28:29*abm quit (Quit: Leaving)
23:29:03FromDiscord<Anonymous Poet> no, its `waitFor sleepAsync(10)`
23:29:47FromDiscord<Anonymous Poet> https://pastebin.com/QhdNgKbR
23:31:17FromDiscord<dom96> I see. Well, that stack trace is pretty useless. I think we should start reporting these as bugs 🙂
23:32:46FromDiscord<Anonymous Poet> i dont disagree
23:32:48FromDiscord<Anonymous Poet> but what is the bug?
23:33:59FromDiscord<dom96> I'm not sure, but one thing that looks wrong is that you're using `newSocket`
23:34:12FromDiscord<dom96> you're mixing synchronous and asynchronous code
23:34:56FromDiscord<dom96> I would expect `socket.connect` to block because the async http server never gets a chance to accept it
23:35:54FromDiscord<Anonymous Poet> in my experience, the issue has always been `.serve`, because either it serves and loops forever, or theres usually a compile error
23:36:07*spiderstew_ quit (Ping timeout: 260 seconds)
23:36:18FromDiscord<dom96> `waitFor sleepAsync(10)` is also wrong
23:36:23FromDiscord<Anonymous Poet> i agree that this use case is wonky (trying to have the server and client be the same program to one another)
23:36:27*spiderstew joined #nim
23:36:33FromDiscord<dom96> because there is no guarantee every async operation will complete in 10 ms
23:36:52FromDiscord<Anonymous Poet> true, but i just need it to context switch so the server can process
23:37:05FromDiscord<Anonymous Poet> idk if thats a hard cutoff at 10 ms, or if it just gets added to the ready queue at that point
23:37:16FromDiscord<Anonymous Poet> in either case, 10ms is more than long enough for these tests
23:37:22FromDiscord<Anonymous Poet> and maybe what we're trying to do shouldnt even be possible
23:37:38FromDiscord<Anonymous Poet> but idk if theres a way to have two binaries running with the current test suites
23:38:06FromDiscord<dom96> no, don't go down that route
23:38:21FromDiscord<dom96> What you need to do is the following:
23:39:06*Vladar quit (Quit: Leaving)
23:39:16FromDiscord<dom96> remove `await request.respond(Http200, "Good")` with `request.client.close()` (not sure about that `client` field name, but AFAIK there is a way to do this)
23:39:21FromDiscord<dom96> (edit) "remove" => "replace"
23:40:03FromDiscord<dom96> replace `block:` with proc runTest(expected, input: string) {.async.} =
23:40:29leorizedisruptek: is cps usable yet? I'm thinking of using it to create reentrant procs
23:41:18FromDiscord<dom96> and use `newAsyncSocket` instead of `newSocket`
23:42:04FromDiscord<dom96> That being said, I just realised why you're getting this crash: asynchttpserver doesn't like being `close`d (seems like a bug :/)
23:43:00FromDiscord<dom96> so instead of creating and closing a new instance in each test, just have a global instance for all tests
23:43:17*jmiven left #nim ("bye")
23:43:47FromDiscord<Anonymous Poet> part of the problem is that the handler has the asserts; can i replace that at runtime?
23:44:23leorizedisruptek: and the links to the docs are broken...
23:47:33FromDiscord<dom96> @Anonymous Poet just set a global var with the expected values 🙂
23:48:06FromDiscord<dom96> replacing the handler shouldn't fail, but not sure you can do that
23:50:34FromDiscord<Anonymous Poet> so are you saying i should use `expected` as a global? that might work actually
23:55:28*abm joined #nim
23:57:15*piron joined #nim