<< 21-11-2019 >>

00:03:25*uu91 quit (Ping timeout: 250 seconds)
00:04:10*uu91 joined #nim
00:05:42*ng0 quit (Quit: Alexa, when is the end of world?)
00:06:05*ng0 joined #nim
00:07:43FromDiscord<trey.merkley> Oh that makes me happy @@mratsim. Does it come with compilation to mobile support?
00:08:26*uu91 quit (Ping timeout: 240 seconds)
00:09:09*uu91 joined #nim
00:10:42*Simerax quit (Quit: https://quassel-irc.org - Komfortabler Chat. Überall.)
00:11:37FromDiscord<mratsim> I never managed to compile it due to DOtherside issues but I don't see why it wouldn't work
00:13:14*uu91 quit (Ping timeout: 240 seconds)
00:13:54*uu91 joined #nim
00:14:21FromDiscord<mratsim> I finally reached the end of my rope with generic symbol resolution @Araq, I manage to trigger that in the middle of std/atomics without any workaround :/
00:18:02*uu91 quit (Ping timeout: 240 seconds)
00:19:53*uu91 joined #nim
00:26:03*uu91 quit (Read error: Connection reset by peer)
00:26:41*Hideki_ joined #nim
00:27:14*uu91 joined #nim
00:30:56*krux02_ joined #nim
00:31:38*uu91 quit (Ping timeout: 240 seconds)
00:33:19*krux02 quit (Ping timeout: 250 seconds)
00:37:16*Hideki_ quit (Ping timeout: 265 seconds)
00:38:58*ng0 quit (Quit: Alexa, when is the end of world?)
00:46:04*uu91 joined #nim
01:04:26*uu91 quit (Ping timeout: 240 seconds)
01:04:55*uu91 joined #nim
01:10:22*clyybber quit (Quit: WeeChat 2.6)
01:12:30*uu91 quit (Read error: Connection reset by peer)
01:12:44*uu91 joined #nim
01:18:16*krux02_ quit (Quit: Leaving)
01:21:42FromGitter<s0kil> How would I go about generating JavaScript at compile time inside a Nim application?
01:24:05*krux02 joined #nim
01:24:52madpropsworking on this thing https://github.com/madprops/sym
01:27:41FromGitter<s0kil> Is there a pragma I could add to output JS?
01:29:51*krux02 quit (Remote host closed the connection)
01:31:55FromGitter<Willyboar> @madprops Araq would love this :P
01:32:19FromGitter<Willyboar> !github yaml
01:32:20disbothttps://github.com/flyx/NimYAML -- YAML implementation for Nim
01:32:21disbothttps://github.com/nim-appkit/yaml -- Robust YAML parser for Nim.
01:32:21disbothttps://github.com/nonylene/yaml2json -- Convert yaml to json
02:14:53*endragor joined #nim
02:18:34*endragor quit (Remote host closed the connection)
02:34:14*Hideki_ joined #nim
02:38:26*Hideki_ quit (Ping timeout: 240 seconds)
02:54:53*theelous3 quit (Ping timeout: 245 seconds)
03:08:32*rockcavera quit (Remote host closed the connection)
03:38:08*skrylar[m] joined #nim
03:38:09skrylar[m]eh. thunderstrike will probably get a windows port when it works
03:38:28*NimBot joined #nim
03:42:39*endragor joined #nim
03:54:25*ltriant quit (Ping timeout: 252 seconds)
03:58:48*uu91 quit (Read error: Connection reset by peer)
03:59:04*uu91 joined #nim
04:04:02*fredrik92 quit (Ping timeout: 240 seconds)
04:04:45*couven92 joined #nim
04:10:39FromGitter<zacharycarter> what's thunderstrike?
04:15:08*nsf joined #nim
04:34:43*oculuxe joined #nim
04:35:57*oculux quit (Ping timeout: 240 seconds)
04:37:17*chemist69 quit (Ping timeout: 276 seconds)
04:38:54*chemist69 joined #nim
04:45:27*bacterio joined #nim
04:45:27*bacterio quit (Changing host)
04:45:27*bacterio joined #nim
05:06:01*a_chou joined #nim
05:06:23FromGitter<gogolxdong> How to recveive from a socket the length of what was sent every time?
05:08:31*dddddd quit (Remote host closed the connection)
05:08:45*a_chou quit (Remote host closed the connection)
05:10:35leorizeyou can't, all you can is to read data from it until there aren't any left
05:14:43*sealmove quit (Quit: WeeChat 2.6)
05:15:35FromGitter<zacharycarter> you could send the size of the packet as the first n bytes in the packet
05:21:28madpropsis it possible to use {} inside """ """ ?
05:28:05*njoseph quit (Ping timeout: 246 seconds)
05:36:19FromGitter<gogolxdong> @leorize, have to specify a length every time right? If it reads all every time it's what I want.
05:49:12FromDiscord<demotomohiro> @madprops
05:49:13FromDiscord<demotomohiro> !eval import strformat; var x=1; echo &"""x={x}"""
05:49:17NimBotx=1
05:57:21*njoseph joined #nim
06:01:33FromGitter<gogolxdong> You can cast a socket to fd then to file in C, so newFileStream and readAll() works for socket in theory, but casting to File stops at ptr CFile.
06:15:14FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5dd62b72167c4f62b78eb4f6]
06:15:24FromGitter<gogolxdong> Is this permitted?
06:19:20*thomasross quit (Ping timeout: 276 seconds)
06:22:15*thomasross joined #nim
06:27:46leorize@gogolxdong you can only read by chunks, sadly
06:28:55leorizesockets are not files
06:29:07leorizeyou can't treat them like one
06:29:22leorizewith that said, readall is still possible
06:29:34leorizejust loop the read until nothing is returned :P
06:29:38*thomasross quit (Ping timeout: 240 seconds)
06:30:45*thomasross joined #nim
06:35:21Zevv*Everything* is a file!
06:35:30*solitudesf joined #nim
06:36:03*Hideki_ joined #nim
06:36:35FromGitter<s0kil> How could I import a pragma from a module?
06:36:48FromGitter<s0kil> `from emitjs import {.emitJS.}`
06:38:59FromGitter<gogolxdong> Let's simplify this question, is it possible to readAll from a socket as file stream?
06:39:58FromGitter<gogolxdong> and why server cannot recv anything after sending as https://play.nim-lang.org/#ix=22p4
06:40:11*Hideki_ quit (Ping timeout: 246 seconds)
06:56:10lqdev[m]s0kil: you can't
06:56:39lqdev[m]unless it's a macro or a template, that is
06:58:27*bacterio quit (Ping timeout: 240 seconds)
07:13:27FromGitter<s0kil> Marco `macro emitJS*(x: untyped): untyped` That is used as a pragma
07:14:51leorizes0kil: just do it as usual: `from emitjs import emitjs`
07:15:52FromGitter<s0kil> When I try to use it, compiler throws: `Error: invalid pragma: emitJS`
07:16:43FromGitter<s0kil> ```from emitjs import emitJS ⏎ ⏎ proc clientSocket*(): string {.emitJS.}``` [https://gitter.im/nim-lang/Nim?at=5dd639db59cbd054a2d6c58e]
07:16:49FromGitter<zacharycarter> @gogolxdong - even when reading from a stream you have to know the size of the data you want to read from it
07:17:04FromGitter<zacharycarter> you could try to implement readAll and use a socket as the source of what you're reading from
07:17:11FromGitter<zacharycarter> https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/streams.nim#L243
07:17:26FromGitter<zacharycarter> though if you try to read data from a socket that doesn't have any more data to read, I'm not sure what will happen
07:23:52*PMunch joined #nim
07:50:52Zevvdefault sockets block, unless configured not to do so
07:53:52*ponyrider quit (Quit: WeeChat 2.6)
07:58:07PMunchHmm, with `curl https://nim-lang.org/choosenim/init.sh -sSf | sh` is there a way to run the script with `-y`?
07:59:58*ponyrider joined #nim
08:00:00*gmpreussner quit (Quit: kthxbye)
08:04:32*gmpreussner joined #nim
08:07:58FromGitter<zacharycarter> I'm using ENet for my RTS game's networking and will probably also use Steam as an alternate networking backend
08:15:05PMunchSteam has a networking system?
08:15:08FromGitter<gogolxdong> the post is incomplete , https://play.nim-lang.org/#ix=22po has more detail.
08:15:32FromGitter<s0kil> Why is `echo` so stubborn? `proc(e: Event) = echo e.target`
08:16:22PMunchs0kil, what do you mean?
08:16:59FromGitter<s0kil> I'm trying to output `e.target`
08:17:11PMunchecho e.target?
08:17:21FromGitter<s0kil> Yes
08:17:54FromGitter<s0kil> Altern In JS World: `console.log(e.target)`, always works
08:19:14PMunchSo echo e.target doesn't work? What is target?
08:20:09FromGitter<s0kil> `typeof Node`
08:20:53PMunchSo implement a "proc `$`(x: Node): string" procedure
08:20:58PMunchThen `echo` will work
08:21:29*ng0 joined #nim
08:25:43FromGitter<s0kil> Sticking to the good ol days: `proc kout*[T](x: T) {.importc: "console.log", varargs, deprecated.}`
08:26:42FromGitter<s0kil> It just seems like something `echo` should be able to handle
08:27:33PMunchecho is generally fairly good at this..
08:27:50*GordonBGood joined #nim
08:33:02FromGitter<gogolxdong> @PMunch do you have some ideas, I'm using binaryparse.
08:33:51PMunchOh cool, what's your issue?
08:36:38FromGitter<gogolxdong> for simplicity I paste code together , https://play.nim-lang.org/#ix=22pt
08:37:53PMunchHmm, binaryparse isn't installed on the playground.. Maybe I should fix that
08:38:33PMunchWhat is the actual issue you are having though?
08:39:19FromGitter<gogolxdong> Server doesn't recieve no matter what was sent.
08:39:49FromGitter<gogolxdong> but echo buff shows the content just before it was sent.
08:41:18PMunchDo you have the full code so I can run it?
08:41:40PMunchThis is missing at least the "variableLengthEncoding" and "packetNumber" definitions
08:41:50FromGitter<gogolxdong> ok.
08:42:40PMunchBy the way, a seq[uint8|byte|char] can simply be cast to a string
08:44:55FromGitter<mratsim> @s0kil for debugging use echo foo.repr
08:45:37FromGitter<s0kil> @mratsim If only it would work (:
08:46:57FromGitter<gogolxdong> How to send you three files?
08:48:04PMunchThree different pastes?
08:48:12PMunchOr zip them? :P
08:48:54FromGitter<gogolxdong> client : https://play.nim-lang.org/#ix=22px
08:49:24FromGitter<gogolxdong> parsers: https://play.nim-lang.org/#ix=22py
08:49:48FromGitter<gogolxdong> server: https://play.nim-lang.org/#ix=22pz
08:51:20*Vladar joined #nim
08:51:54PMunchCreated a minimal sockets example that doesn't work either
08:51:55PMunchHold on
08:54:43FromGitter<s0kil> > How could I import a macro pragma from a module? ⏎ ⏎ @mratsim
09:04:11PMunchgogolxdong, which Nim version are you using?
09:05:13PMunchgogolxdong, nvm managed to compile with devel
09:05:19PMunchHere is a server that receives data: http://ix.io/22pD/
09:05:29FromGitter<zacharycarter> PMunch: yeah it does steamworks includes it but it's also here: https://github.com/ValveSoftware/GameNetworkingSockets
09:05:50FromGitter<gogolxdong> latest devel
09:08:07PMunchzacharycarter, huh cool
09:08:29FromGitter<gogolxdong> yes, it receives data, and `Unable to read the requested amount of bytes from file`
09:09:00PMunchYeah I saw that..
09:10:19*tklohna joined #nim
09:10:37PMunchLooking at the received output shows that it is in fact not the same as what was sent
09:11:13PMunchAh
09:11:37PMunchChange `addr buff` in the sending code to `addr buff[0]`
09:12:09PMunchRight now you are sending the size and capacity of the buffer as well, which messes things up
09:12:28PMunchYou want the address of the underlying string data, which can be found at buff[0]
09:12:29FromGitter<gogolxdong> great, got the right result.
09:12:34PMunch:D
09:12:55PMunchSo, apart from that you couldn't get it to work, what do you think of binaryparse?
09:14:33FromGitter<gogolxdong> It's good at writing binary layout.
09:14:56PMunchHaha, well that's what it does, so good thing it's doing it well :)
09:15:50FromGitter<gogolxdong> It's my first impression about half a year ago.
09:16:48FromGitter<gogolxdong> I cannot image what's it like using regular method to write protocol.
09:20:33FromGitter<s0kil> Is there a reason why `dom` module does not have `innerHTML`?
09:21:19PMunchgogolxdong, yeah it's a pain..
09:21:26PMunchThat's why I wrote the library :)
09:22:28FromGitter<gogolxdong> It's a kind of DSL, right?
09:22:42PMunchs0kil, good question..
09:23:15FromGitter<s0kil> https://github.com/pragmagic/karax/blob/master/karax/kdom_impl.nim should be merged into `dom` module
09:24:08PMunchgogolxdong, indeed. If you pass -d:binaryparseecho to Nim you can see what it rewrites it to (spoiler, it's not very nice)
09:29:10FromGitter<gogolxdong> interesting.
09:34:51*JustASlacker joined #nim
09:36:52*letto_ quit (Quit: Konversation terminated!)
09:38:26*letto joined #nim
09:53:39FromGitter<zacharycarter> I believe nesm has an example of sending data over sockets and serializing / de-serializing
09:53:47FromGitter<zacharycarter> just in case you want more examples @gogolxdong
09:55:26FromGitter<gogolxdong> ok, I saw you mentioned binaryparse a few days ago, what's it for?
10:04:45Araqwow down to 0.2s for VCC
10:05:58PMunchIn the GCC benchmarks
10:06:02PMunch?
10:06:07Araqonly problem is that I don't understand the assembler
10:07:04Araqbut it's way faster than GCC
10:07:30AraqI think the asm is still stupid and would do well with a little bit of help from the Nim compiler though
10:22:32*narimiran joined #nim
10:24:37*krux02 joined #nim
10:26:16*narimiran quit (Client Quit)
10:26:37*narimiran joined #nim
10:35:11PMunchWhen was SystemError removed? Trying to build an old Nim project
10:37:37*Hideki joined #nim
10:37:39FromDiscord<mratsim> It has been superceded by UserError
10:38:01*Hideki is now known as Guest364
10:38:09FromDiscord<mratsim> but I guess SystemError are Errors of the Uncatchable kind so it's supposed to be a Defect?
10:41:09*nif quit (Quit: ...)
10:41:19*nif joined #nim
10:42:35*Guest364 quit (Ping timeout: 276 seconds)
10:44:57*dddddd joined #nim
10:48:27lqdev[m]@s0kil saying "it doesn't work" doesn't help us help you with your issue. describe your problem.
10:49:31*abm joined #nim
10:53:55*clyybber joined #nim
10:57:40FromGitter<s0kil> `echo` should accept any [T] when compiled to JS
10:58:11FromGitter<s0kil> `proc echo[T](x: T) {.importc: "console.log", varargs.}`
10:59:26PMunchmratsim, I was just looking for which Nim version I had to choosenim in order to compile it. 0.18.0 seems to work fine :)
10:59:49PMunchIs there a way to install choosenim without automatically installing stable by the way?
11:08:59clyybbermratsim, Araq: Perhaps https://github.com/nim-lang/Nim/issues/12695 should be a Showstopper?
11:09:02disbot^ Atomic symbol resolution: unable to use std/atomics
11:09:02disbot^ snippet at https://play.nim-lang.org/#ix=22q2 😏
11:10:04FromDiscord<mratsim> I think high-priority, what I don't understand is that I have 5 channels implementations that use generics, but only this one is causing issues: https://github.com/mratsim/weave/tree/master/weave/channels
11:10:39FromDiscord<mratsim> sorry 4 that uses atomics
11:10:46FromDiscord<mratsim> one is lock-based
11:11:34FromDiscord<mratsim> ah I just realize, all the others uses fully instantiated Atomic[int] or Atomic[bool]
11:11:44FromDiscord<mratsim> that's the only one using Atomic[T]
11:16:02FromDiscord<mratsim> The workaround is to either not use list-based channels (to avoid Atomic[T] and only use Atomic[int]) but that's not an option when you need to support an unbounded amount of messages, or use Atomic[pointer] and cast the pointer before use, which is annoying but can be done.
11:20:04clyybbermratsim: Found another workaround: https://play.nim-lang.org/#ix=22q4
11:20:39clyybberI don't know if you want to support anything other than trivil
11:21:36FromDiscord<mratsim> ah seems good
11:21:52clyybberThe issue in the compiler seems to be that it is not reinstantiating the generic after additional constraints come into play. But I don't know how to fix it :(
11:21:56FromDiscord<mratsim> yes that works, it's only for pointer / ptr T
11:22:00clyybberNice
11:22:15FromDiscord<mratsim> you can add your solution in the issue
11:23:01clyybberdone
11:24:42*rockcavera joined #nim
11:36:03*GordonBGood quit (Read error: Connection reset by peer)
11:37:49*sleepyqt joined #nim
11:37:55*sleepyqt_ joined #nim
11:39:20*sleepyqt quit (Client Quit)
11:39:20*sleepyqt_ quit (Client Quit)
11:39:39*sleepyqt joined #nim
11:39:46*GordonBGood joined #nim
11:46:06*GordonBGood quit (Read error: Connection reset by peer)
11:47:38*NimBot joined #nim
11:50:09*GordonBGood joined #nim
12:00:45FromDiscord<yewpad> Is there a way to intepret Nim code at runtime? Like load a Nims file at runtime and intepret it with using the standard library? That is, of course, if the std lib is capable of that
12:02:24Araqyup. see tests/tcompilerapi for an example
12:02:36Araqthe Nim compiler can be embedded into your Nim project
12:02:44FromDiscord<yewpad> Sick!
12:02:50FromDiscord<yewpad> Thank you.
12:04:02FromDiscord<yewpad> I'm building a server orchestration software (in Nim) and wanted to use Nim script as, well you guessed it, scripting language so that I can expose the internals
12:05:18FromDiscord<yewpad> (Kind of)
12:17:50FromDiscord<mratsim> @Clyybber unfortunately your solution is not compatible with concepts, it crashes the compiler: https://github.com/nim-lang/Nim/issues/12695#issuecomment-557055498
12:17:51disbot^ Atomic symbol resolution: unable to use std/atomics
12:17:52disbot^ snippet at https://play.nim-lang.org/#ix=22q2 😏
12:19:10clyybberJust saw that :(
12:20:27FromDiscord<mratsim> actually even your solution crashes
12:20:38FromDiscord<mratsim> but there is no message
12:21:16clyybberah damn it, I just tested it on the playground and it segfaulted and I assumed it did so at runtime
12:22:14FromDiscord<krab4t> nim has something like this https://doc.qt.io/qt-5/qfilesystemwatcher.html ?
12:26:48Araqkrab4t: I've seen Nimble packages that do that
12:29:40FromDiscord<exelotl> Is there a way to use nimscript as a REPL?
12:31:09FromDiscord<yewpad> @exelotl I just found this here: https://github.com/nim-lang/Nim/blob/39290cf88c5047e86dc4894e3190c63d5985f56f/compiler/nimeval.nim#L130
12:32:00FromDiscord<mratsim> you might be stuck with https://github.com/nim-lang/Nim/issues/12293 @exelotl @yewpad
12:32:04disbot^ compiler as a library: findNimStdLibCompileTime fails to find system.nim
12:32:04disbot^ snippet at https://play.nim-lang.org/#ix=22qc 😏
12:33:35FromDiscord<yewpad> Well, it finds the std lib when I compile but I can't use any module that is in the std lib. Tried to run the NimScript example where the distros get printed and it tells me that the file 'distros' cannot be open
12:34:11FromDiscord<yewpad> This is my 'interpreter': https://play.nim-lang.org/#ix=22qd
12:34:36FromDiscord<yewpad> And this is the file I'm trying to interpret: https://play.nim-lang.org/#ix=22qe
12:34:53FromDiscord<yewpad> Upon execution I get: `D:\projects\playground\nim\interpret\simple.nim(1, 8) Error: cannot open file: distros`
12:35:14*tklohna quit (Ping timeout: 240 seconds)
12:37:01*Vladar quit (Quit: Leaving)
12:44:27FromDiscord<krab4t> hm so far ive found only this proc https://github.com/jiro4989/monit/blob/master/src/monit.nim#L95
12:47:09FromDiscord<krab4t> or fsmonitor from graveyard
12:47:14FromDiscord<krab4t> why its in graveyard
12:48:20*tklohna joined #nim
12:49:13*Hideki joined #nim
12:49:36*Hideki is now known as Guest10389
12:49:40FromDiscord<krab4t> ` when defined(linux) or defined(nimdoc): from posix import read else: {.error: "Your platform is not supported.".} `
12:49:41FromDiscord<krab4t> 🙂
13:06:09FromGitter<zacharycarter> probably because no one is using it
13:06:28FromGitter<zacharycarter> and it's unmaintained or something replaced it
13:07:26FromGitter<zacharycarter> most cross platform file system watchers that I've seen don't support macOS which of course has its own API for this
13:07:48FromGitter<zacharycarter> I wrote macOS support for one a while ago, but I don't think I have the code anymore
13:07:51FromGitter<zacharycarter> and it was in C++
13:08:20FromGitter<zacharycarter> well - Objective C really I guess
13:11:37*tklohna quit (Ping timeout: 240 seconds)
13:11:59*tklohna joined #nim
13:16:35*endragor quit (Remote host closed the connection)
13:33:36*tklohna quit (Ping timeout: 240 seconds)
13:47:30*tklohna joined #nim
13:48:38*Guest10389 quit (Ping timeout: 245 seconds)
13:49:21*GordonBGood quit (Ping timeout: 250 seconds)
13:56:36*tiorock joined #nim
13:56:47*tiorock quit (Changing host)
13:56:47*tiorock joined #nim
13:56:47*rockcavera quit (Killed (orwell.freenode.net (Nickname regained by services)))
13:56:47*tiorock is now known as rockcavera
14:05:53*narimiran quit (Quit: leaving)
14:06:37PMunchyewpad, you still here?
14:06:59PMunchFigured out that the issue is that the paths added to createInterpreter are not recursive
14:08:25*narimiran joined #nim
14:08:37FromGitter<Willyboar> !github symlink
14:08:38disbothttps://github.com/AndrewVos/slink -- Symlink dotfiles
14:08:38disbothttps://github.com/madprops/sym -- Symlink creator and manager
14:08:38disbothttps://github.com/samdmarshall/hero -- dot file symlink creator
14:13:15FromGitter<alehander92> !github compiler
14:13:17disbothttps://github.com/arnetheduck/nlvm -- LLVM-based compiler for the Nim language
14:13:18disbothttps://github.com/nim-lang/Nim -- Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority).
14:13:19disbothttps://github.com/h3rald/hastyscribe -- Self-contained markdown compiler generating self-contained HTML documents
14:13:28FromGitter<alehander92> fun bot
14:13:44PMunchyewpad, do something like this: http://ix.io/22qN
14:13:58FromGitter<Willyboar> this bot is very cool
14:14:14PMunch!help
14:14:23PMunchHmm
14:14:25PMunchHey disbot
14:14:44PMunchIgnoring me are we?
14:15:03PMunchdisruptek, is there a list of things your bot knows?
14:15:05PMunch!github disbot
14:15:06disbotno results 😢
14:15:26FromGitter<Willyboar> !disbot list
14:15:39PMunch!disbot help
14:15:51FromGitter<Willyboar> This would be a nice feature
14:17:03clyybber!github vulkan
14:17:04disbothttps://github.com/nimious/vulkan -- Nim bindings for Vulkan, the API for access to graphics and compute on GPUs.
14:17:04disbothttps://github.com/Clyybber/vulkanim -- Vulkan bindings for nim
14:17:04disbothttps://github.com/nimgl/nimgl -- NimGL is a Nim library that offers bindings for popular libraries used in computer graphics
14:17:44clyybber!github dalvik
14:17:45disbothttps://github.com/akavel/dali -- Indie assembler/linker for Dalvik VM .dex & .apk files (Work In Progress)
14:19:48FromGitter<s0kil> Are there any best practices for maintainable macros?
14:21:15PMunchNot anything that's been written down I don't think
14:21:42PMunchDid you have anything in particular in mind?
14:21:49FromGitter<mratsim> expectKind is your friend
14:22:13PMunchI really think we should make some abstractions over NimNode..
14:22:34PMunchLike implement a procName template that does expectkind on the given NimNode and then gets the correct index
14:22:51PMunchWould make things a bit more readable as well..
14:23:56PMunchIn general the macros module could do with a bit more helpers..
14:25:17FromGitter<mratsim> I use lot of small procs: and have several comments: ⏎ https://github.com/numforge/laser/blob/master/laser/photon_jit/x86_64/x86_64_op_generator.nimhttps://github.com/mratsim/Arraymancer/blob/master/src/tensor/private/p_accessors_macros_desugar.nim
14:26:17*narimiran quit (Quit: leaving)
14:26:59PMunchI use long unreadable monsterprocs :P
14:27:00*narimiran joined #nim
14:27:10PMunchWith literally zero comments
14:28:06*narimiran quit (Client Quit)
14:28:22PMunchHmm, that's actually not quite correct: https://github.com/PMunch/protobuf-nim/blob/master/src/protobuf.nim
14:28:22*narimiran joined #nim
14:28:30FromGitter<mratsim> and for some stuff I have a when false with my debug impl: https://github.com/numforge/laser/blob/master/laser/primitives/matrix_multiplication/gemm_ukernel_generator.nim#L149-L160
14:28:39PMunchI use several large procedures, but still zero comments apart from doc-comments
14:31:34FromDiscord<Rika> why no comments?
14:31:48FromGitter<s0kil> `p_accessors_macros_desugar.nim` is nice
14:32:05*sealmove joined #nim
14:32:33PMunchRika, because I'm lazy
14:33:07*tklohna quit (Ping timeout: 250 seconds)
14:33:21PMunchWell there's a bit more to that. Comments tend to just never be changed, so they can be directly misleading. I prefer to use good variable/procedure names and try to write my code as self explanatory as possible
14:33:33*tklohna joined #nim
14:34:28*sagax joined #nim
14:42:33FromGitter<mratsim> Yeah but it’s hard with macros because you substitute overloading with case blocks
14:43:25FromGitter<mratsim> if we add overloading: "proc foo(x: NimNode{nkSym}) =“ that would be helpful
14:43:51FromGitter<mratsim> maybe it works if it works for macros
14:46:59FromGitter<alehander92> i agree
14:47:11FromGitter<alehander92> i often do as PMunch (probably even less comments)
14:47:22PMunchNegative comments?
14:47:26FromGitter<alehander92> but this is pretty bad
14:47:29PMunchHow does that work?
14:47:38FromGitter<alehander92> as i realized when i thought about how would other people work with this code
14:47:44FromGitter<alehander92> obviously .. :D
14:47:58FromGitter<alehander92> so now i try to add more comments, but still forget about it most of the time
14:48:09FromGitter<alehander92> PMunch haha well no
14:48:11PMunchWell, for the most part I'm the only one who works on my projects
14:48:35PMunchBut I still manage to get lost in them if it's been a while since I built them
14:48:38FromGitter<alehander92> one can autowarn when a function changes for one to check its docstring
14:48:49FromGitter<alehander92> but its probably a lot of false positives
14:48:58FromGitter<alehander92> PMunch thats not true
14:49:08FromGitter<alehander92> in open source many people are potential contributors
14:49:22FromGitter<alehander92> i do the same as you, but its a bad idea :P
14:49:58PMunchI've found that potential contributers =/= actual contributors
14:50:18FromGitter<alehander92> i guess some comments for truly non-obvious stuff or source of a pattern or motivation are most useful
14:50:19FromGitter<Willyboar> You must build an extension in your editor when define a proc to throw a pop up with comment input
14:50:27FromGitter<Willyboar> :P
14:50:37FromGitter<alehander92> PMunch well .. maybe our code quality scares contributors :P
14:51:01FromGitter<alehander92> i dont think this is the reason, but yeah, even for your future self its good
14:51:18FromGitter<alehander92> i sometimes get lost in my old code as well .. adding comments like # TODO: why ?
14:51:33PMunchHaha
14:51:34federico3alehander92: that's really bad
14:51:38PMunchI try to avoid that
14:51:44FromGitter<alehander92> i agree federico3 !
14:51:57PMunchMy comments are more like the rationale for doing something odd
14:52:03FromGitter<alehander92> @Willyboar yeah something like that
14:52:22FromGitter<alehander92> federico3 usually one understands after a bit of thinking/reminding oneself of the context
14:52:28FromGitter<alehander92> but still, not optimal
14:52:46FromGitter<alehander92> PMunch yeah, but what's obvious to you might be still odd for other people sometimes
14:53:19FromGitter<alehander92> and i feel maybe inline comments are good for that
14:53:35FromGitter<alehander92> because when you change code its easier to notice they're wrong or slightly old now
14:53:43FromGitter<alehander92> instead of checking the big doc on top
14:54:19*ITChap joined #nim
14:54:51PMunchOh yeah, for sure
14:55:04PMunchBut people tend to edit code without even reading the comments
14:55:21FromGitter<alehander92> but that now is part of a code review process
14:55:24PMunchI've seen so many comments that are just plain wrong, or not remotely related to where they are placed because of a copy/paste thing
14:55:52FromGitter<alehander92> well, yeah, not perfect solution
14:55:53FromGitter<mratsim> you need discipline
14:56:05FromGitter<mratsim> I tend to always read comment before code though
14:56:08FromGitter<alehander92> and literature education
14:56:23*MarquisdeFalbala joined #nim
14:56:25FromGitter<mratsim> I have no education, never did CS. I can’t reverse a linked list ;)
14:56:49FromGitter<alehander92> well, you have high school at least
14:56:53FromGitter<alehander92> come on mamy :P
14:57:38FromGitter<alehander92> les miserables as a comment
14:58:11FromGitter<mratsim> debugging concurrency is miserable yes
14:59:04*nsf quit (Quit: WeeChat 2.6)
14:59:17FromGitter<mratsim> debugging generics early symbol resolution is downright hellish ;)
14:59:33FromGitter<alehander92> i think its not
14:59:40FromGitter<alehander92> anyway, gotta work
15:00:10FromDiscord<Joco223> Is it possible to run a method of an object on destructor/scope exit?
15:02:43*ITChap quit (Quit: ITChap)
15:04:06*ITChap joined #nim
15:05:35*Hideki joined #nim
15:05:48*ng0 quit (Quit: Alexa, when is the end of world?)
15:05:59*Hideki is now known as Guest40993
15:06:18*ng0 joined #nim
15:06:50FromDiscord<itmuckel> LOL, I was wondering why my game stutters. After two hours I found out that I was casting (1000f / FPS) to int. 🙈
15:11:40AraqJoco223: give the type a proc `=destroy`
15:12:44*nif quit (Quit: ...)
15:12:54*nif joined #nim
15:13:47*PMunch quit (Quit: Leaving)
15:15:24*Guest40993 quit (Remote host closed the connection)
15:17:47FromDiscord<Joco223> Ok, thanks
15:20:30*Hideki joined #nim
15:20:54*Hideki is now known as Guest81495
15:24:40*norm joined #nim
15:25:02*norm is now known as Guest35601
15:26:08*bacterio joined #nim
15:28:02*Guest81495 quit (Remote host closed the connection)
15:28:53*Vladar joined #nim
15:56:09*bacterio quit (Read error: Connection reset by peer)
15:59:10*ITChap quit (Quit: ITChap)
16:01:22*ITChap joined #nim
16:02:48*narimiran quit (Quit: leaving)
16:04:28*JustASlacker quit (Ping timeout: 252 seconds)
16:04:45*krux02 quit (Remote host closed the connection)
16:05:59*tklohna quit (Remote host closed the connection)
16:17:51*narimiran joined #nim
16:19:15*tklohna joined #nim
16:21:25*Hideki joined #nim
16:21:47*Hideki is now known as Guest9275
16:23:33*narimiran quit (Quit: leaving)
16:25:18*narimiran joined #nim
16:34:37*tklohna quit (Ping timeout: 240 seconds)
16:42:10*krux02 joined #nim
16:46:15*krux02 quit (Remote host closed the connection)
16:47:54*sleepyqt quit (Quit: Leaving)
16:48:36*tklohna joined #nim
16:58:22madpropsis there a reason why procs are not hoisted?
16:59:18FromDiscord<Lesnar> Can someone explain me how `const` works in this case? https://pastebin.com/hvcRe9DY
16:59:31*ITChap quit (Quit: ITChap)
17:05:17FromDiscord<Lesnar> I can assign procs to `var` or `let` and call them, but it doesn't work with `const`. I get `Error: VM problem: dest register is not set`
17:06:01FromDiscord<Lesnar> But in the paste I've linked, it just works fine with a proc from the stdlib
17:07:28*Trustable joined #nim
17:08:38*nsf joined #nim
17:25:30*tklohna quit (Ping timeout: 265 seconds)
17:38:03*MarquisdeFalbala quit (Remote host closed the connection)
17:38:16madpropsis there a way to make nimble just install dependencies
17:38:21madpropsinstead of trying to install my own project
17:41:05FromDiscord<yewpad> dunno, via `nimble test` or something like this?
17:45:42Guest35601lc is deprecated. What is recommended alternative
17:53:38FromGitter<mratsim> @Araq ^ you better have plenty of collect examples :p
17:55:59madpropsexamples are so important
17:56:44solitudesfmadprops, nimble install -d
17:56:52madpropsadded a way to add them in my argument parser on --help http://i.imgur.com/IZJ6VDa.png
17:56:57madpropsoh cool
17:59:23*uvegbot quit (Ping timeout: 276 seconds)
17:59:45*uvegbot joined #nim
18:00:11*jua_ joined #nim
18:05:21*GordonBGood joined #nim
18:07:27*rockcavera quit (Remote host closed the connection)
18:08:14*tane joined #nim
18:09:38*GordonBGood quit (Ping timeout: 240 seconds)
18:10:57*abm quit (Ping timeout: 240 seconds)
18:25:19*MarquisdeFalbala joined #nim
18:29:10*Guest35601 quit (Quit: Leaving)
18:31:50FromDiscord<yewpad> @madprops You might want to comment out or mark the messages that is sent by you app in the examples you provided ^^ At first it is pretty confusing what is a command in the shell and what is a message sent by your app
18:32:28madpropsyou mean in the image?
18:32:46FromDiscord<yewpad> yup
18:33:33FromDiscord<yewpad> Remove an item:
18:33:33FromDiscord<yewpad> via name - sym remove movies
18:33:33FromDiscord<yewpad> via regex - sym remove re:\\w+
18:33:44FromDiscord<yewpad> Somethin' like this would do the job
18:37:26*MnlPhlp joined #nim
18:39:26*theelous3 joined #nim
18:45:03Araqmratsim: thanks for reminding me
18:50:58planetis[m]for collect grab this -> https://gist.github.com/b3liever/0a5b80abb0ca1d24c64d81ea89be12c5
18:52:04*sagax quit (Quit: Konversation terminated!)
18:52:15*sagax joined #nim
18:54:40AraqI took this: https://github.com/alehander92/comprehension/pull/1/files
18:54:46Araqwhat's the difference ?
18:55:37*Guest9275 quit (Ping timeout: 240 seconds)
18:56:48planetis[m]araq: the one i linked started from your collect macro and I added sets and tables
18:56:59Araqare you b3liever?
18:57:32planetis[m]yes
18:58:03planetis[m]oh you mean the pr I made some time ago
18:58:15planetis[m]well I developed it further
18:59:15*NimBot joined #nim
18:59:39planetis[m]they're almost identical
18:59:41Araqthe only thing I dislike a bit is that it's tied to tables and sets
19:01:16planetis[m]i dont like it either... especial the ``{v}`` and ``{k: v}`` thing
19:02:09sealmovehey planetis
19:02:17planetis[m]at the end of the day I know I will never use this macro, its just fp non-sense
19:02:42planetis[m]hi sealmove what's up?
19:02:50Araqhey, bummer ...
19:03:03AraqI like it very much
19:03:13Araqas it's FP applied correctly :P
19:03:22Araqno interim results to optimize away
19:03:32Araqjust turn the statements into an expression
19:03:40sealmovestarted developing Nim version of Kaitai Struct, it's also a CT library based on macros instead of an external exe ;D https://github.com/sealmove/nimitai
19:04:51Araqplanetis[m], do you happen to have more tests for it?
19:05:15planetis[m]nope, never used it
19:05:34planetis[m]sealmove: nice
19:05:38Araqbah, I suspected you want it badly and used it extensively
19:07:53planetis[m]hahaha
19:08:42Araqmaybe we also need collectAs(body, initHashSet)
19:09:05planetis[m]i just wanted to learn how your macro worked that's all :)
19:09:14Araqor initHashSet.collect(...)
19:09:54*jjido joined #nim
19:10:20planetis[m]and what about tables?
19:10:50*uu91 quit (Ping timeout: 240 seconds)
19:10:56AraqinitTable.collect(...) obviously
19:11:00*uu91 joined #nim
19:11:16Araq{k: v} becomes res[k] = v
19:11:26Araq{v} becomes res.add v
19:12:17planetis[m]so you still keep the last ``{v}``
19:12:53planetis[m]``initTable.collect(for (i, d) in data.pairs: {i: d})`` ?
19:13:35AraqI guess so, yes
19:13:58planetis[m]well let me see what i can do
19:14:14planetis[m]where will i post it when i'am done?
19:14:26planetis[m]make a pr in Nim repo?
19:14:50Araqyeah
19:15:35Araqextra points if you analyse the body a bit so that the initTable/newSeq call has a nice initial size
19:15:37planetis[m]ok tomorrow pbl
19:16:05planetis[m]any examples of that?
19:16:19planetis[m]strfmt?
19:18:52Araqsequtils.toSeq attempts to do it
19:19:03Araqbut for 'collect' it needs to be done differently
19:19:15FromGitter<alehander92> planetis[m]
19:19:19FromGitter<alehander92> i had an idea for your macro
19:19:42FromGitter<alehander92> it was to instead do it with a default seq returner and explicit optional type
19:19:43FromGitter<alehander92> so e.g.
19:19:47FromGitter<alehander92> collect(...) stuff
19:19:47Araqfor every 'for' loop you need to see if x.len exists but if there is an 'if' inside the body, you shouldn't guess and don't do it at all
19:19:59FromGitter<alehander92> and collectTable (....)
19:20:07FromGitter<alehander92> `collect[YourCustomType](...)`
19:20:08FromGitter<alehander92> etc
19:20:18FromGitter<alehander92> where it just does the same thing it does now
19:20:36FromGitter<alehander92> but it gets the `adder` and `init` macro code from overloads for the given typeclass
19:20:50Araqmeh, in fact, collect(initTable(lenHint), body) is good enough I suppose
19:21:22Araqyou only need to support partial constructor calls
19:21:37FromGitter<alehander92> well this isi also an option but then you need to teach it how to "add"
19:21:51FromGitter<alehander92> my api makes that easier for both the caller and the implementer imo
19:21:55planetis[m]ok will look araq
19:21:59FromGitter<alehander92> my proposed api for planetis[m]
19:22:00Araqty
19:22:58Araqor maybe
19:23:02planetis[m]alehander92: supporting custom types, is a nice thing to do
19:23:04FromGitter<alehander92> as this collect(<initcode>, body) wouldn't work with a custom collection
19:23:16Araqcourse it would
19:23:18planetis[m]but i want a girlfriend instead :)
19:23:19FromGitter<alehander92> planetis[m] my point is that if i recall your implementation, it should be very easy to add
19:23:25FromGitter<alehander92> to your implementation with small changes
19:23:43Araqthe collection all support []= or 'add' depending on the collection
19:23:50FromGitter<alehander92> i can try to patch it to show what i mean
19:23:51Araqwe have guidelines for this
19:24:01Araqand because of this.
19:24:23FromGitter<alehander92> Araq hm, ok, did we have `overloadExists` in macros.nim
19:24:44*nif quit (Quit: ...)
19:24:50FromGitter<alehander92> but i see what you mean, one can just assume `[]=` when there are two arguments
19:24:54*nif joined #nim
19:25:03Araq someValue # res.add someValue
19:25:03FromGitter<alehander92> and `add` when there is 1
19:25:10Araq {v} # res.incl v
19:25:17Araq {k: v} # res[k] = v
19:25:24FromGitter<alehander92> ok, thats great too
19:25:58Araq {v} as IntSet # with explicit type annotation
19:26:37FromGitter<alehander92> i think the init thing would benefit from similar convention
19:26:41Araqmight be the best design, so we have nice defaults but it works with any collection
19:26:44FromGitter<alehander92> something like https://github.com/nim-lang/RFCs/issues/48
19:26:48AraqI know
19:26:55Araqbut one step after the other
19:27:14AraqI think with an optional 'as' it's close to perfect
19:27:28FromGitter<alehander92> how would `as` look
19:27:52FromGitter<alehander92> planetis[m] jump next level, directly marry !
19:28:19planetis[m]nice will order a bride asap
19:28:27Araqlet stuff = collect:
19:28:27Araq for k, v in table.pairs():
19:28:27Araq {k: v} as SortedTable
19:29:00FromGitter<alehander92> hmm
19:29:10FromGitter<alehander92> but wouldnt collect[SortedTable] be more obvious
19:29:16FromGitter<alehander92> especially to the reader
19:29:30*Araq shrugs
19:29:46AraqI like it this way, it's clearly something a bit weird going on
19:29:48FromGitter<alehander92> and also, if you have `if` you have to repeat two `as` and check if they are compatible
19:29:57Araqso there is no need to fake generics [] here
19:30:08FromGitter<alehander92> yeah but you have to look for it deeper inside the expression
19:30:16FromGitter<alehander92> one can easily miss it imo and say "uh probably a seq"
19:30:34Araqnot really, it's close to the most essential part of the expression
19:30:44FromGitter<alehander92> well, its almost faking, it basically is "generic"
19:30:52FromGitter<alehander92> just not using the default generic mechanism :P
19:31:39Araqbut look, there is a difference
19:31:55Araqcollect[Table](...) # Table what? [string, int]?
19:32:26planetis[m]i like araq last example too
19:32:33Araqyou only pass it a type class anyway
19:32:52FromGitter<alehander92> well, then it can be collect(typeclass): k
19:32:58planetis[m]initTable.collect ... not at all
19:33:14FromGitter<alehander92> this way its more similar to other api-s receiving types
19:33:22AraqinitTable(sizeHintHere).collect(...)
19:33:24FromGitter<alehander92> like a.to(int)
19:33:48Araqyeah yeah yeah, the old story, must be consistent with some other random stuff over there.
19:33:55*Vladar quit (Quit: Leaving)
19:34:04FromGitter<alehander92> totally not, your objection was
19:34:06Araqbut the size hints are important very often
19:34:08FromGitter<alehander92> that its not consistent
19:34:14FromGitter<alehander92> i didnt care much
19:34:20Araqso maybe we should focus on them
19:34:28*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:34:44Araqotherwise we're in C# land where we need to rewrite LINQ code as soon as performance is important
19:35:37*tklohna joined #nim
19:35:40FromGitter<alehander92> well, this is almost the same as my idea then
19:35:57FromGitter<alehander92> my thing would be just `collect(typ.myinit):`
19:35:58FromGitter<alehander92> instead
19:36:14planetis[m]so make it ``{k: v} as SortedTable(64)``
19:36:22Araqah so now it's *your* idea :P
19:36:37Araqanyway, we have 2 questions here:
19:36:49FromGitter<alehander92> my mini idea was only using `typeclass` as arg :P
19:36:54Araq* type part of collect or inside the collect
19:37:02Araq* type or init call
19:38:01Araqsince it's Nim where we focus on efficiency when it doesn't cost us much if any maintainability we need the init call as that's the only one supporting size hints
19:38:22FromGitter<alehander92> i agree that somtimes size is useful, but imo one can still support both, with auto-adding an `newSeq` / table / `init` for custom type if only a type is passed
19:39:45*uvegbot quit (Quit: Konversation terminated!)
19:40:11*uvegbot joined #nim
19:40:17planetis[m]i guess inferring the init call from the type is bad, right?
19:40:46FromGitter<alehander92> however i can't not notice that Araq is also using a fake version of generics :P initTable<no args>(size) (or is that possible)
19:40:51Araqplanetis[m], not sure, but it's fine to assume an idiomatic nim API
19:41:04FromGitter<alehander92> planetis i think its best but it needs an implemented RFC
19:41:43AraqI think new experimental syntax sugar doesn't need a fullblown RFC
19:42:00*jjido joined #nim
19:42:34FromGitter<alehander92> i meant the standard `init` for all kinds of types thing
19:42:42Araqoh
19:42:43FromGitter<alehander92> but yeah probably fine to assum
19:42:44AraqI see
19:44:04Araqthe verbs are clear at least, it's add, incl and []=
19:44:18planetis[m]yes you can't assume if ``SomeType`` is ref or plain object
19:44:27Araqnotice that sets and intsets.nim do use 'incl' and *not* 'add'
19:44:34Araqfor better or worse...
19:44:56FromGitter<alehander92> planetis[m] but you can check that
19:45:00FromGitter<alehander92> on macro time iirc
19:45:24Araqah your macro already uses 'incl', nice
19:45:40planetis[m] ok ``initTable(sizeHintHere).collect(...)`` it is for me, I wonder what you guys will settle to
19:45:48Araqand don't bindSym these so that the macro implementation doesn't import these modules
19:46:26FromGitter<alehander92> hmm, now i wonder something else, can we collect into an existing variable
19:46:30FromGitter<alehander92> or would that be too much
19:46:41planetis[m]yes
19:46:46Araqwe can't, we rely on the move optimizer
19:46:59Araqgood that it's part of the spec now
19:47:10Araq(and that it actually works...)
19:47:41FromGitter<alehander92> so if i have a = collect .. it might be possible to directly do the allocation/.add on `a` ?
19:47:43planetis[m]that's another nice option saves as from some trouble
19:48:00FromGitter<alehander92> hm, but it cant possibly know if `a` is already allocated
19:48:19FromGitter<alehander92> but thats a pretty niche case
19:48:57Araqalehander42: the macro cannot see the 'let x = macroHere' part
19:49:10planetis[m]oh I was thinking ``var a = initTable[string, int](64); collect(a): for ..``
19:49:12Araqmacros can only influence what's passed to them
19:49:33Araqwell that misses the point
19:49:33FromGitter<alehander92> Araq yes i thought about copy ellision or something like that
19:49:42FromGitter<alehander92> yes i meant what planetis[m] shows
19:49:45Araqwe have copy ellision, relax.
19:49:49FromGitter<alehander92> i imagined collect(initcode, body) => collect(var collection, body)
19:49:57Araqthat misses the point!
19:50:13Araqif it's not an expression, it doesn't *do* anything whatsoever then
19:50:39FromGitter<alehander92> i see
19:51:08planetis[m]^ see what i meant, i dont even understand fp
19:51:30Araqyou do understand FP. turn stuff into expressions. that's FP.
19:52:02FromGitter<alehander92> i learned `no allocations good` and now i forgot to fp
19:53:56FromGitter<alehander92> well so `collect(initCode, code) and `collect(code) #inferring seq/set/table by default`
19:55:57FromGitter<alehander92> another thing i dont agree for `as` is that if somebody has his own `as` operator (e.g. some kind of conversion)
19:56:09FromGitter<alehander92> it might be confusing inside the body
19:57:31*Araq sighs
19:57:51Araqpure speculation. and it would have to be an 'as' that doesn't really return a value
19:58:05AraqI'll be dead before that becomes a real problem
19:58:30Araqin fact, I have yet to see an overloaded 'as' operator.
19:58:37planetis[m]i thing araq wants to avoid infering as this means it will have to import sets/tables
19:58:57Araqdon't import sets/tables, that would be a closed design
19:59:13Araqin fact, currently your macro doesn't work with intsets as far as I can tell
19:59:28Araqand we're getting new collection types (narimiran's sorta)
20:01:02clyybbersorta?
20:01:42narimiranclyybber, that's what you get when i don't want to spend any time on thinking about names :P
20:01:53FromGitter<alehander92> Araq it is still possible, no reason imo when one can just not mess with the code block
20:02:04clyybbernarimiran: sorta cool
20:02:26clyybbernarimiran: but what is it?
20:02:29planetis[m]narimiran: what did you have in mind when you thought this name?
20:02:35narimiranSORted TAbles
20:02:38FromGitter<alehander92> planetis hm, i so how would it work for sets
20:02:38clyybbersorta something
20:02:52FromGitter<alehander92> if no inferring
20:04:18FromGitter<alehander92> Araq anyway, the init thing, it needs another assumption
20:04:27planetis[m]alehander the ``{v}`` thing translates to ``a.incl d``
20:05:06planetis[m]plain ``v`` to add
20:05:09FromGitter<alehander92> planetis[m] i mean inferring initSet
20:05:20FromGitter<alehander92> that <function>(<args>) should be converted to <function><type> (<args>) <= Araq
20:05:57FromGitter<alehander92> e.g. initTable(size) => initTablekey, value (size)
20:06:15FromGitter<alehander92> probably its a fine assumption
20:06:20Araqyeah so your lovely typedesc based inits don't work :P
20:06:25FromGitter<alehander92> yeaah :(
20:06:54*narimiran quit (Quit: leaving)
20:07:13Araqthe only problem with initTable(90).collect is that it's not convenient enough
20:07:46FromGitter<alehander92> you can have collect(size, code) overload
20:08:01FromGitter<alehander92> which just calls those inits with size
20:08:09FromGitter<alehander92> custom types just add their full init code
20:08:17FromGitter<alehander92> or support such an overload
20:08:46*narimiran joined #nim
20:09:24Araqunfortunately in today's Nim 'untyped' bites overloading
20:09:54Araqit really bites back
20:09:57FromGitter<alehander92> well it doesnt need to be real overload
20:10:14FromGitter<alehander92> hmm it kinda does sometimes
20:10:32FromGitter<alehander92> because initCode can't be `typed` ok
20:13:50FromGitter<alehander92> hm, for stuff like `newString(50).collect` work we need to add a check that checks when typeof<initCall> is not generic
20:14:21FromGitter<alehander92> otherwise newStringstring (50)
20:15:30FromGitter<alehander92> another option is to just assume `K` `V` and `T` similar to `it` in mapIt
20:15:32FromGitter<alehander92> for initCode
20:15:40FromGitter<alehander92> and support `collect(initTable[K, V](50)`
20:16:00FromGitter<alehander92> but this would be confusing in already generic functions, i know, horrible overengineering
20:17:39*rockcavera joined #nim
20:20:55planetis[m]oops thats a problem
20:21:25*nsf quit (Quit: WeeChat 2.6)
20:26:24*nc-x[m] quit (*.net *.split)
20:26:25*ng0 quit (*.net *.split)
20:26:25*leorize quit (*.net *.split)
20:35:23*ng0 joined #nim
20:36:00*leorize joined #nim
20:40:06*Simerax joined #nim
20:53:05*Hideki_ joined #nim
20:55:51*tiorock joined #nim
20:55:52*tiorock quit (Changing host)
20:55:52*tiorock joined #nim
20:55:52*rockcavera is now known as Guest45640
20:55:52*Guest45640 quit (Killed (card.freenode.net (Nickname regained by services)))
20:55:52*tiorock is now known as rockcavera
20:57:14*Hideki_ quit (Ping timeout: 240 seconds)
21:02:19FromDiscord<trey.merkley> Is there a way to iterate over a seq and see if a variable matches the text of an enclosed sequence?
21:02:27FromDiscord<trey.merkley> Is there a way to iterate over a seq and see if a variable matches the text of an enclosed variable?
21:03:57Zevv!eval echo @[10, 30, 70].find(30) != -1
21:04:01NimBottrue
21:05:10Zevvecho @["ten", "thirty", "seventy"].find("thirty") != -1
21:07:23*jonafato- joined #nim
21:07:26*d10n_ joined #nim
21:07:26*FromDiscord_ joined #nim
21:07:53*Trustable quit (Ping timeout: 276 seconds)
21:08:04*ng0 quit (Ping timeout: 260 seconds)
21:08:19*shashlick_ joined #nim
21:08:53*Ekho quit (Disconnected by services)
21:09:11*narimiran quit (Ping timeout: 276 seconds)
21:09:11*sealmove quit (Ping timeout: 276 seconds)
21:09:23FromDiscord_<trey.merkley> actually, can you generally explain why this works? it looks like it finds the 30 in the sequence and then echos it out, but why is the `!eval` there too?
21:09:36*sealmove joined #nim
21:10:52*thomasross_ joined #nim
21:10:52*thomasross quit (Killed (karatkievich.freenode.net (Nickname regained by services)))
21:10:52*thomasross_ is now known as thomasross
21:11:23*ng0 joined #nim
21:11:51*Pistos2 joined #nim
21:12:12*Trustable_2 joined #nim
21:12:17FromDiscord<trey.merkley> why the `!= -1`?
21:12:17*shashlick quit (Remote host closed the connection)
21:12:17*jonafato quit (Quit: ZNC - http://znc.in)
21:12:17*d10n quit (Quit: why all the #hashtags #lol #hackers #overheard)
21:12:17*Trustable_2 is now known as 17SAA35VG
21:12:17*Trustable_2 joined #nim
21:12:17*FromDiscord quit (Remote host closed the connection)
21:12:17*Pistos quit (Ping timeout: 240 seconds)
21:12:36shashlick_testing
21:12:50*Trustable_2 quit (Ping timeout: 240 seconds)
21:13:22*shashlick_ quit (Quit: quit)
21:14:51*shashlick joined #nim
21:18:05*MnlPhlp left #nim ("WeeChat 2.6")
21:21:33*Ekho joined #nim
21:22:50*sagax quit (Ping timeout: 240 seconds)
21:23:13*thomasross quit (Ping timeout: 245 seconds)
21:28:35Zevvthe !eval part is to let nimbot run the code
21:28:52Zevvthe find() function returns the index of the element you are looking for, or -1 if it is not found
21:29:08Zevvdoes that make sense?
21:29:53FromGitter<topcheese> I was going to guess not equal to the end of the seq. Oh well.
21:30:33Zevv-1 is easier, you can check against that always without having to know the length of the seq
21:32:16*thomasross joined #nim
21:46:58FromDiscord_<trey.merkley> okay, so building off of that
21:47:32Araquse 'find() < 0' for smaller code size
21:48:18FromDiscord_<trey.merkley> var = 30
21:49:02*tane quit (Quit: Leaving)
21:49:05FromDiscord_<trey.merkley> if @[10,30,70].find(var)
21:49:05FromDiscord_<trey.merkley> return var
21:49:20FromDiscord_<trey.merkley> would be how it works right?
21:49:42Zevv!eval 30 in @[10, 30, 70]
21:49:44NimBotCompile failed: /usercode/in.nim(1, 4) Error: expression 'contains(@[10, 30, 70], 30)' is of type 'bool' and has to be discarded
21:50:02Zevv!eval echo 30 in @[10, 30, 70]
21:50:06NimBottrue
21:50:22Zevvor like that
21:50:31FromDiscord_<trey.merkley> okay, neat, thanks
21:56:13Araqor you use 'contains'
21:56:50ZZZtyZdiscard result or assign it to a variable and use it
21:59:09ZZZtyZdiscard contains(@[10, 30, 70], 30)
21:59:09ZZZtyZecho contains(@[10, 30, 70], 30)
21:59:09ZZZtyZvar res: bool = contains(@[10, 30, 70], 30)
22:02:06*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:03:08*tklohna quit (Ping timeout: 276 seconds)
22:06:03*jjido joined #nim
22:14:21madpropswhat's a better way to do this? https://play.nim-lang.org/#ix=22td
22:14:32madpropskeys seems to be an iterator only
22:14:51*ZZZtyZ quit (Quit: leaving)
22:17:51FromDiscord_<yewpad> I might be completely mistaken, but Nimble doesn't support multi-module projects, like declaring one lib package and a bunch of binary packages and building them all together, am I right?
22:18:03FromDiscord_<yewpad> Because this feels waayyyyyyy to hacky: https://github.com/blockleague/2tools/blob/master/toTools.nimble#L16
22:18:11FromDiscord_<yewpad> I need alternatives
22:22:32FromDiscord_<yewpad> And I don't want to create a bunch of GitHub repositories for every single tool.
22:23:29FromDiscord_<yewpad> Nvm, I got a solution.
22:24:22*uu91 quit (Read error: Connection reset by peer)
22:24:36*uu91 joined #nim
22:25:52Mike[m]7Hey, how do I set the byte alignment of object fields? I'm trying to talk to the Vulkan API, and it expects a struct with very specific alignments for all the values
22:26:13Mike[m]7Nim puts the enums into 1 byte, for example, but vulkan is expecting them to be 8
22:30:52*ltriant joined #nim
22:34:04Araqadd .size: 8 to your enum declaration
22:34:43*uu91 quit (Read error: Connection reset by peer)
22:35:01*uu91 joined #nim
22:38:53dom96CfP deadline for FOSDEM is in 5 days: https://forum.nim-lang.org/t/5577
22:39:54dom96Araq, @zah, @mratsim, yglukhov[m], ^^
22:40:12dom96Ping anyone else who you'd like to encourage to submit a talk ;)
22:42:41Mike[m]7Araq: I tried that actually, and while I can set the size of enums to 8 bytes, it still doesn't align all the fields correctly. uint32 is sometimes padded with an extra 4 bytes depending on how big the other fields are
22:50:12*ng0 quit (Quit: Alexa, when is the end of world?)
22:51:48*17SAA35VG quit (Remote host closed the connection)
22:53:26FromDiscord_<yewpad> Am I the only one where 'after' and 'before' blocks won't get called by nimble?
22:54:17FromDiscord_<yewpad> Like 'after build:' doesn't get called
22:54:37clyybberMike: Just a heads up, I made a vulkan binding https://github.com/Clyybber/vulkanim
22:57:02Mike[m]7Have you had any issues with byte alignment? I'm using the nimgl/vulkan bindings and in particular I'm having issues with passing the VkSwapchainCreateInfoKHR struct to vkCreateSwapchainKHR
22:57:33clyybberI didn't have any issues, but I also didn't try nimgl's bindings
22:58:18Mike[m]7Cool, I think I'll try refactoring against your bindings then. I'm just worried I'll end up in the same place
22:58:37*solitudesf quit (Ping timeout: 240 seconds)
22:58:51clyybberMike: If you do, I'll be glad to help
23:00:58Mike[m]7Awesome, thank you. I'll probably start playing with it tonight
23:02:26*Hideki_ joined #nim
23:04:20FromDiscord_<yewpad>
23:04:20FromDiscord_<yewpad> https://cdn.discordapp.com/attachments/371759389889003532/647210715773534227/unknown.png
23:04:28FromDiscord_<yewpad> I can't even overwrite the task itself
23:04:36FromDiscord_<yewpad> It doesn't print jackshit
23:06:15clyybberyewpad: Try changing the second line to `echo "jackshit"`
23:07:13*Hideki_ quit (Ping timeout: 265 seconds)
23:07:21clyybberjk, is that nimble or nake?
23:07:25FromDiscord_<yewpad> nimble
23:08:03clyybberhmm, maybe ask dom96 about it
23:08:05FromDiscord_<yewpad> https://play.nim-lang.org/#ix=22tr
23:08:24FromDiscord_<yewpad> https://play.nim-lang.org/#ix=22ts
23:08:44FromDiscord_<yewpad> @dom96 I need your assistance man
23:13:24*uu91 quit (Read error: Connection reset by peer)
23:13:41*uu91 joined #nim
23:20:21*jua_ quit (Quit: Leaving)
23:32:22dom96you can't overwrite built-in commands like this right now IIRC
23:35:37FromDiscord_<yewpad> Geez
23:35:39FromDiscord_<yewpad> fine then
23:35:46madpropsis there a better way to do this? https://play.nim-lang.org/#ix=22td
23:38:04*MarquisdeFalbala quit (Remote host closed the connection)
23:59:43FromGitter<deech> Found a mascot https://en.wikipedia.org/wiki/Nim_Chimpsky