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:43 | FromDiscord | <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:37 | FromDiscord | <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:21 | FromDiscord | <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:42 | FromGitter | <s0kil> How would I go about generating JavaScript at compile time inside a Nim application? |
01:24:05 | * | krux02 joined #nim |
01:24:52 | madprops | working on this thing https://github.com/madprops/sym |
01:27:41 | FromGitter | <s0kil> Is there a pragma I could add to output JS? |
01:29:51 | * | krux02 quit (Remote host closed the connection) |
01:31:55 | FromGitter | <Willyboar> @madprops Araq would love this :P |
01:32:19 | FromGitter | <Willyboar> !github yaml |
01:32:20 | disbot | https://github.com/flyx/NimYAML -- YAML implementation for Nim |
01:32:21 | disbot | https://github.com/nim-appkit/yaml -- Robust YAML parser for Nim. |
01:32:21 | disbot | https://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:09 | skrylar[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:39 | FromGitter | <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:23 | FromGitter | <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:35 | leorize | you 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:35 | FromGitter | <zacharycarter> you could send the size of the packet as the first n bytes in the packet |
05:21:28 | madprops | is it possible to use {} inside """ """ ? |
05:28:05 | * | njoseph quit (Ping timeout: 246 seconds) |
05:36:19 | FromGitter | <gogolxdong> @leorize, have to specify a length every time right? If it reads all every time it's what I want. |
05:49:12 | FromDiscord | <demotomohiro> @madprops |
05:49:13 | FromDiscord | <demotomohiro> !eval import strformat; var x=1; echo &"""x={x}""" |
05:49:17 | NimBot | x=1 |
05:57:21 | * | njoseph joined #nim |
06:01:33 | FromGitter | <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:14 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5dd62b72167c4f62b78eb4f6] |
06:15:24 | FromGitter | <gogolxdong> Is this permitted? |
06:19:20 | * | thomasross quit (Ping timeout: 276 seconds) |
06:22:15 | * | thomasross joined #nim |
06:27:46 | leorize | @gogolxdong you can only read by chunks, sadly |
06:28:55 | leorize | sockets are not files |
06:29:07 | leorize | you can't treat them like one |
06:29:22 | leorize | with that said, readall is still possible |
06:29:34 | leorize | just 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:21 | Zevv | *Everything* is a file! |
06:35:30 | * | solitudesf joined #nim |
06:36:03 | * | Hideki_ joined #nim |
06:36:35 | FromGitter | <s0kil> How could I import a pragma from a module? |
06:36:48 | FromGitter | <s0kil> `from emitjs import {.emitJS.}` |
06:38:59 | FromGitter | <gogolxdong> Let's simplify this question, is it possible to readAll from a socket as file stream? |
06:39:58 | FromGitter | <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:10 | lqdev[m] | s0kil: you can't |
06:56:39 | lqdev[m] | unless it's a macro or a template, that is |
06:58:27 | * | bacterio quit (Ping timeout: 240 seconds) |
07:13:27 | FromGitter | <s0kil> Marco `macro emitJS*(x: untyped): untyped` That is used as a pragma |
07:14:51 | leorize | s0kil: just do it as usual: `from emitjs import emitjs` |
07:15:52 | FromGitter | <s0kil> When I try to use it, compiler throws: `Error: invalid pragma: emitJS` |
07:16:43 | FromGitter | <s0kil> ```from emitjs import emitJS ⏎ ⏎ proc clientSocket*(): string {.emitJS.}``` [https://gitter.im/nim-lang/Nim?at=5dd639db59cbd054a2d6c58e] |
07:16:49 | FromGitter | <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:04 | FromGitter | <zacharycarter> you could try to implement readAll and use a socket as the source of what you're reading from |
07:17:11 | FromGitter | <zacharycarter> https://github.com/nim-lang/Nim/blob/version-1-0/lib/pure/streams.nim#L243 |
07:17:26 | FromGitter | <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:52 | Zevv | default sockets block, unless configured not to do so |
07:53:52 | * | ponyrider quit (Quit: WeeChat 2.6) |
07:58:07 | PMunch | Hmm, 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:58 | FromGitter | <zacharycarter> I'm using ENet for my RTS game's networking and will probably also use Steam as an alternate networking backend |
08:15:05 | PMunch | Steam has a networking system? |
08:15:08 | FromGitter | <gogolxdong> the post is incomplete , https://play.nim-lang.org/#ix=22po has more detail. |
08:15:32 | FromGitter | <s0kil> Why is `echo` so stubborn? `proc(e: Event) = echo e.target` |
08:16:22 | PMunch | s0kil, what do you mean? |
08:16:59 | FromGitter | <s0kil> I'm trying to output `e.target` |
08:17:11 | PMunch | echo e.target? |
08:17:21 | FromGitter | <s0kil> Yes |
08:17:54 | FromGitter | <s0kil> Altern In JS World: `console.log(e.target)`, always works |
08:19:14 | PMunch | So echo e.target doesn't work? What is target? |
08:20:09 | FromGitter | <s0kil> `typeof Node` |
08:20:53 | PMunch | So implement a "proc `$`(x: Node): string" procedure |
08:20:58 | PMunch | Then `echo` will work |
08:21:29 | * | ng0 joined #nim |
08:25:43 | FromGitter | <s0kil> Sticking to the good ol days: `proc kout*[T](x: T) {.importc: "console.log", varargs, deprecated.}` |
08:26:42 | FromGitter | <s0kil> It just seems like something `echo` should be able to handle |
08:27:33 | PMunch | echo is generally fairly good at this.. |
08:27:50 | * | GordonBGood joined #nim |
08:33:02 | FromGitter | <gogolxdong> @PMunch do you have some ideas, I'm using binaryparse. |
08:33:51 | PMunch | Oh cool, what's your issue? |
08:36:38 | FromGitter | <gogolxdong> for simplicity I paste code together , https://play.nim-lang.org/#ix=22pt |
08:37:53 | PMunch | Hmm, binaryparse isn't installed on the playground.. Maybe I should fix that |
08:38:33 | PMunch | What is the actual issue you are having though? |
08:39:19 | FromGitter | <gogolxdong> Server doesn't recieve no matter what was sent. |
08:39:49 | FromGitter | <gogolxdong> but echo buff shows the content just before it was sent. |
08:41:18 | PMunch | Do you have the full code so I can run it? |
08:41:40 | PMunch | This is missing at least the "variableLengthEncoding" and "packetNumber" definitions |
08:41:50 | FromGitter | <gogolxdong> ok. |
08:42:40 | PMunch | By the way, a seq[uint8|byte|char] can simply be cast to a string |
08:44:55 | FromGitter | <mratsim> @s0kil for debugging use echo foo.repr |
08:45:37 | FromGitter | <s0kil> @mratsim If only it would work (: |
08:46:57 | FromGitter | <gogolxdong> How to send you three files? |
08:48:04 | PMunch | Three different pastes? |
08:48:12 | PMunch | Or zip them? :P |
08:48:54 | FromGitter | <gogolxdong> client : https://play.nim-lang.org/#ix=22px |
08:49:24 | FromGitter | <gogolxdong> parsers: https://play.nim-lang.org/#ix=22py |
08:49:48 | FromGitter | <gogolxdong> server: https://play.nim-lang.org/#ix=22pz |
08:51:20 | * | Vladar joined #nim |
08:51:54 | PMunch | Created a minimal sockets example that doesn't work either |
08:51:55 | PMunch | Hold on |
08:54:43 | FromGitter | <s0kil> > How could I import a macro pragma from a module? ⏎ ⏎ @mratsim |
09:04:11 | PMunch | gogolxdong, which Nim version are you using? |
09:05:13 | PMunch | gogolxdong, nvm managed to compile with devel |
09:05:19 | PMunch | Here is a server that receives data: http://ix.io/22pD/ |
09:05:29 | FromGitter | <zacharycarter> PMunch: yeah it does steamworks includes it but it's also here: https://github.com/ValveSoftware/GameNetworkingSockets |
09:05:50 | FromGitter | <gogolxdong> latest devel |
09:08:07 | PMunch | zacharycarter, huh cool |
09:08:29 | FromGitter | <gogolxdong> yes, it receives data, and `Unable to read the requested amount of bytes from file` |
09:09:00 | PMunch | Yeah I saw that.. |
09:10:19 | * | tklohna joined #nim |
09:10:37 | PMunch | Looking at the received output shows that it is in fact not the same as what was sent |
09:11:13 | PMunch | Ah |
09:11:37 | PMunch | Change `addr buff` in the sending code to `addr buff[0]` |
09:12:09 | PMunch | Right now you are sending the size and capacity of the buffer as well, which messes things up |
09:12:28 | PMunch | You want the address of the underlying string data, which can be found at buff[0] |
09:12:29 | FromGitter | <gogolxdong> great, got the right result. |
09:12:34 | PMunch | :D |
09:12:55 | PMunch | So, apart from that you couldn't get it to work, what do you think of binaryparse? |
09:14:33 | FromGitter | <gogolxdong> It's good at writing binary layout. |
09:14:56 | PMunch | Haha, well that's what it does, so good thing it's doing it well :) |
09:15:50 | FromGitter | <gogolxdong> It's my first impression about half a year ago. |
09:16:48 | FromGitter | <gogolxdong> I cannot image what's it like using regular method to write protocol. |
09:20:33 | FromGitter | <s0kil> Is there a reason why `dom` module does not have `innerHTML`? |
09:21:19 | PMunch | gogolxdong, yeah it's a pain.. |
09:21:26 | PMunch | That's why I wrote the library :) |
09:22:28 | FromGitter | <gogolxdong> It's a kind of DSL, right? |
09:22:42 | PMunch | s0kil, good question.. |
09:23:15 | FromGitter | <s0kil> https://github.com/pragmagic/karax/blob/master/karax/kdom_impl.nim should be merged into `dom` module |
09:24:08 | PMunch | gogolxdong, indeed. If you pass -d:binaryparseecho to Nim you can see what it rewrites it to (spoiler, it's not very nice) |
09:29:10 | FromGitter | <gogolxdong> interesting. |
09:34:51 | * | JustASlacker joined #nim |
09:36:52 | * | letto_ quit (Quit: Konversation terminated!) |
09:38:26 | * | letto joined #nim |
09:53:39 | FromGitter | <zacharycarter> I believe nesm has an example of sending data over sockets and serializing / de-serializing |
09:53:47 | FromGitter | <zacharycarter> just in case you want more examples @gogolxdong |
09:55:26 | FromGitter | <gogolxdong> ok, I saw you mentioned binaryparse a few days ago, what's it for? |
10:04:45 | Araq | wow down to 0.2s for VCC |
10:05:58 | PMunch | In the GCC benchmarks |
10:06:02 | PMunch | ? |
10:06:07 | Araq | only problem is that I don't understand the assembler |
10:07:04 | Araq | but it's way faster than GCC |
10:07:30 | Araq | I 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:11 | PMunch | When was SystemError removed? Trying to build an old Nim project |
10:37:37 | * | Hideki joined #nim |
10:37:39 | FromDiscord | <mratsim> It has been superceded by UserError |
10:38:01 | * | Hideki is now known as Guest364 |
10:38:09 | FromDiscord | <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:27 | lqdev[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:40 | FromGitter | <s0kil> `echo` should accept any [T] when compiled to JS |
10:58:11 | FromGitter | <s0kil> `proc echo[T](x: T) {.importc: "console.log", varargs.}` |
10:59:26 | PMunch | mratsim, 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:49 | PMunch | Is there a way to install choosenim without automatically installing stable by the way? |
11:08:59 | clyybber | mratsim, Araq: Perhaps https://github.com/nim-lang/Nim/issues/12695 should be a Showstopper? |
11:09:02 | disbot | ^ Atomic symbol resolution: unable to use std/atomics |
11:09:02 | disbot | ^ snippet at https://play.nim-lang.org/#ix=22q2 😏 |
11:10:04 | FromDiscord | <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:39 | FromDiscord | <mratsim> sorry 4 that uses atomics |
11:10:46 | FromDiscord | <mratsim> one is lock-based |
11:11:34 | FromDiscord | <mratsim> ah I just realize, all the others uses fully instantiated Atomic[int] or Atomic[bool] |
11:11:44 | FromDiscord | <mratsim> that's the only one using Atomic[T] |
11:16:02 | FromDiscord | <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:04 | clyybber | mratsim: Found another workaround: https://play.nim-lang.org/#ix=22q4 |
11:20:39 | clyybber | I don't know if you want to support anything other than trivil |
11:21:36 | FromDiscord | <mratsim> ah seems good |
11:21:52 | clyybber | The 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:56 | FromDiscord | <mratsim> yes that works, it's only for pointer / ptr T |
11:22:00 | clyybber | Nice |
11:22:15 | FromDiscord | <mratsim> you can add your solution in the issue |
11:23:01 | clyybber | done |
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:45 | FromDiscord | <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:24 | Araq | yup. see tests/tcompilerapi for an example |
12:02:36 | Araq | the Nim compiler can be embedded into your Nim project |
12:02:44 | FromDiscord | <yewpad> Sick! |
12:02:50 | FromDiscord | <yewpad> Thank you. |
12:04:02 | FromDiscord | <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:18 | FromDiscord | <yewpad> (Kind of) |
12:17:50 | FromDiscord | <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:51 | disbot | ^ Atomic symbol resolution: unable to use std/atomics |
12:17:52 | disbot | ^ snippet at https://play.nim-lang.org/#ix=22q2 😏 |
12:19:10 | clyybber | Just saw that :( |
12:20:27 | FromDiscord | <mratsim> actually even your solution crashes |
12:20:38 | FromDiscord | <mratsim> but there is no message |
12:21:16 | clyybber | ah damn it, I just tested it on the playground and it segfaulted and I assumed it did so at runtime |
12:22:14 | FromDiscord | <krab4t> nim has something like this https://doc.qt.io/qt-5/qfilesystemwatcher.html ? |
12:26:48 | Araq | krab4t: I've seen Nimble packages that do that |
12:29:40 | FromDiscord | <exelotl> Is there a way to use nimscript as a REPL? |
12:31:09 | FromDiscord | <yewpad> @exelotl I just found this here: https://github.com/nim-lang/Nim/blob/39290cf88c5047e86dc4894e3190c63d5985f56f/compiler/nimeval.nim#L130 |
12:32:00 | FromDiscord | <mratsim> you might be stuck with https://github.com/nim-lang/Nim/issues/12293 @exelotl @yewpad |
12:32:04 | disbot | ^ compiler as a library: findNimStdLibCompileTime fails to find system.nim |
12:32:04 | disbot | ^ snippet at https://play.nim-lang.org/#ix=22qc 😏 |
12:33:35 | FromDiscord | <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:11 | FromDiscord | <yewpad> This is my 'interpreter': https://play.nim-lang.org/#ix=22qd |
12:34:36 | FromDiscord | <yewpad> And this is the file I'm trying to interpret: https://play.nim-lang.org/#ix=22qe |
12:34:53 | FromDiscord | <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:27 | FromDiscord | <krab4t> hm so far ive found only this proc https://github.com/jiro4989/monit/blob/master/src/monit.nim#L95 |
12:47:09 | FromDiscord | <krab4t> or fsmonitor from graveyard |
12:47:14 | FromDiscord | <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:40 | FromDiscord | <krab4t> ` when defined(linux) or defined(nimdoc): from posix import read else: {.error: "Your platform is not supported.".} ` |
12:49:41 | FromDiscord | <krab4t> 🙂 |
13:06:09 | FromGitter | <zacharycarter> probably because no one is using it |
13:06:28 | FromGitter | <zacharycarter> and it's unmaintained or something replaced it |
13:07:26 | FromGitter | <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:48 | FromGitter | <zacharycarter> I wrote macOS support for one a while ago, but I don't think I have the code anymore |
13:07:51 | FromGitter | <zacharycarter> and it was in C++ |
13:08:20 | FromGitter | <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:37 | PMunch | yewpad, you still here? |
14:06:59 | PMunch | Figured out that the issue is that the paths added to createInterpreter are not recursive |
14:08:25 | * | narimiran joined #nim |
14:08:37 | FromGitter | <Willyboar> !github symlink |
14:08:38 | disbot | https://github.com/AndrewVos/slink -- Symlink dotfiles |
14:08:38 | disbot | https://github.com/madprops/sym -- Symlink creator and manager |
14:08:38 | disbot | https://github.com/samdmarshall/hero -- dot file symlink creator |
14:13:15 | FromGitter | <alehander92> !github compiler |
14:13:17 | disbot | https://github.com/arnetheduck/nlvm -- LLVM-based compiler for the Nim language |
14:13:18 | disbot | https://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:19 | disbot | https://github.com/h3rald/hastyscribe -- Self-contained markdown compiler generating self-contained HTML documents |
14:13:28 | FromGitter | <alehander92> fun bot |
14:13:44 | PMunch | yewpad, do something like this: http://ix.io/22qN |
14:13:58 | FromGitter | <Willyboar> this bot is very cool |
14:14:14 | PMunch | !help |
14:14:23 | PMunch | Hmm |
14:14:25 | PMunch | Hey disbot |
14:14:44 | PMunch | Ignoring me are we? |
14:15:03 | PMunch | disruptek, is there a list of things your bot knows? |
14:15:05 | PMunch | !github disbot |
14:15:06 | disbot | no results 😢 |
14:15:26 | FromGitter | <Willyboar> !disbot list |
14:15:39 | PMunch | !disbot help |
14:15:51 | FromGitter | <Willyboar> This would be a nice feature |
14:17:03 | clyybber | !github vulkan |
14:17:04 | disbot | https://github.com/nimious/vulkan -- Nim bindings for Vulkan, the API for access to graphics and compute on GPUs. |
14:17:04 | disbot | https://github.com/Clyybber/vulkanim -- Vulkan bindings for nim |
14:17:04 | disbot | https://github.com/nimgl/nimgl -- NimGL is a Nim library that offers bindings for popular libraries used in computer graphics |
14:17:44 | clyybber | !github dalvik |
14:17:45 | disbot | https://github.com/akavel/dali -- Indie assembler/linker for Dalvik VM .dex & .apk files (Work In Progress) |
14:19:48 | FromGitter | <s0kil> Are there any best practices for maintainable macros? |
14:21:15 | PMunch | Not anything that's been written down I don't think |
14:21:42 | PMunch | Did you have anything in particular in mind? |
14:21:49 | FromGitter | <mratsim> expectKind is your friend |
14:22:13 | PMunch | I really think we should make some abstractions over NimNode.. |
14:22:34 | PMunch | Like implement a procName template that does expectkind on the given NimNode and then gets the correct index |
14:22:51 | PMunch | Would make things a bit more readable as well.. |
14:23:56 | PMunch | In general the macros module could do with a bit more helpers.. |
14:25:17 | FromGitter | <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.nim ⏎ https://github.com/mratsim/Arraymancer/blob/master/src/tensor/private/p_accessors_macros_desugar.nim |
14:26:17 | * | narimiran quit (Quit: leaving) |
14:26:59 | PMunch | I use long unreadable monsterprocs :P |
14:27:00 | * | narimiran joined #nim |
14:27:10 | PMunch | With literally zero comments |
14:28:06 | * | narimiran quit (Client Quit) |
14:28:22 | PMunch | Hmm, 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:30 | FromGitter | <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:39 | PMunch | I use several large procedures, but still zero comments apart from doc-comments |
14:31:34 | FromDiscord | <Rika> why no comments? |
14:31:48 | FromGitter | <s0kil> `p_accessors_macros_desugar.nim` is nice |
14:32:05 | * | sealmove joined #nim |
14:32:33 | PMunch | Rika, because I'm lazy |
14:33:07 | * | tklohna quit (Ping timeout: 250 seconds) |
14:33:21 | PMunch | Well 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:33 | FromGitter | <mratsim> Yeah but it’s hard with macros because you substitute overloading with case blocks |
14:43:25 | FromGitter | <mratsim> if we add overloading: "proc foo(x: NimNode{nkSym}) =“ that would be helpful |
14:43:51 | FromGitter | <mratsim> maybe it works if it works for macros |
14:46:59 | FromGitter | <alehander92> i agree |
14:47:11 | FromGitter | <alehander92> i often do as PMunch (probably even less comments) |
14:47:22 | PMunch | Negative comments? |
14:47:26 | FromGitter | <alehander92> but this is pretty bad |
14:47:29 | PMunch | How does that work? |
14:47:38 | FromGitter | <alehander92> as i realized when i thought about how would other people work with this code |
14:47:44 | FromGitter | <alehander92> obviously .. :D |
14:47:58 | FromGitter | <alehander92> so now i try to add more comments, but still forget about it most of the time |
14:48:09 | FromGitter | <alehander92> PMunch haha well no |
14:48:11 | PMunch | Well, for the most part I'm the only one who works on my projects |
14:48:35 | PMunch | But I still manage to get lost in them if it's been a while since I built them |
14:48:38 | FromGitter | <alehander92> one can autowarn when a function changes for one to check its docstring |
14:48:49 | FromGitter | <alehander92> but its probably a lot of false positives |
14:48:58 | FromGitter | <alehander92> PMunch thats not true |
14:49:08 | FromGitter | <alehander92> in open source many people are potential contributors |
14:49:22 | FromGitter | <alehander92> i do the same as you, but its a bad idea :P |
14:49:58 | PMunch | I've found that potential contributers =/= actual contributors |
14:50:18 | FromGitter | <alehander92> i guess some comments for truly non-obvious stuff or source of a pattern or motivation are most useful |
14:50:19 | FromGitter | <Willyboar> You must build an extension in your editor when define a proc to throw a pop up with comment input |
14:50:27 | FromGitter | <Willyboar> :P |
14:50:37 | FromGitter | <alehander92> PMunch well .. maybe our code quality scares contributors :P |
14:51:01 | FromGitter | <alehander92> i dont think this is the reason, but yeah, even for your future self its good |
14:51:18 | FromGitter | <alehander92> i sometimes get lost in my old code as well .. adding comments like # TODO: why ? |
14:51:33 | PMunch | Haha |
14:51:34 | federico3 | alehander92: that's really bad |
14:51:38 | PMunch | I try to avoid that |
14:51:44 | FromGitter | <alehander92> i agree federico3 ! |
14:51:57 | PMunch | My comments are more like the rationale for doing something odd |
14:52:03 | FromGitter | <alehander92> @Willyboar yeah something like that |
14:52:22 | FromGitter | <alehander92> federico3 usually one understands after a bit of thinking/reminding oneself of the context |
14:52:28 | FromGitter | <alehander92> but still, not optimal |
14:52:46 | FromGitter | <alehander92> PMunch yeah, but what's obvious to you might be still odd for other people sometimes |
14:53:19 | FromGitter | <alehander92> and i feel maybe inline comments are good for that |
14:53:35 | FromGitter | <alehander92> because when you change code its easier to notice they're wrong or slightly old now |
14:53:43 | FromGitter | <alehander92> instead of checking the big doc on top |
14:54:19 | * | ITChap joined #nim |
14:54:51 | PMunch | Oh yeah, for sure |
14:55:04 | PMunch | But people tend to edit code without even reading the comments |
14:55:21 | FromGitter | <alehander92> but that now is part of a code review process |
14:55:24 | PMunch | I'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:52 | FromGitter | <alehander92> well, yeah, not perfect solution |
14:55:53 | FromGitter | <mratsim> you need discipline |
14:56:05 | FromGitter | <mratsim> I tend to always read comment before code though |
14:56:08 | FromGitter | <alehander92> and literature education |
14:56:23 | * | MarquisdeFalbala joined #nim |
14:56:25 | FromGitter | <mratsim> I have no education, never did CS. I can’t reverse a linked list ;) |
14:56:49 | FromGitter | <alehander92> well, you have high school at least |
14:56:53 | FromGitter | <alehander92> come on mamy :P |
14:57:38 | FromGitter | <alehander92> les miserables as a comment |
14:58:11 | FromGitter | <mratsim> debugging concurrency is miserable yes |
14:59:04 | * | nsf quit (Quit: WeeChat 2.6) |
14:59:17 | FromGitter | <mratsim> debugging generics early symbol resolution is downright hellish ;) |
14:59:33 | FromGitter | <alehander92> i think its not |
14:59:40 | FromGitter | <alehander92> anyway, gotta work |
15:00:10 | FromDiscord | <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:50 | FromDiscord | <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:40 | Araq | Joco223: 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:47 | FromDiscord | <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:22 | madprops | is there a reason why procs are not hoisted? |
16:59:18 | FromDiscord | <Lesnar> Can someone explain me how `const` works in this case? https://pastebin.com/hvcRe9DY |
16:59:31 | * | ITChap quit (Quit: ITChap) |
17:05:17 | FromDiscord | <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:01 | FromDiscord | <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:16 | madprops | is there a way to make nimble just install dependencies |
17:38:21 | madprops | instead of trying to install my own project |
17:41:05 | FromDiscord | <yewpad> dunno, via `nimble test` or something like this? |
17:45:42 | Guest35601 | lc is deprecated. What is recommended alternative |
17:53:38 | FromGitter | <mratsim> @Araq ^ you better have plenty of collect examples :p |
17:55:59 | madprops | examples are so important |
17:56:44 | solitudesf | madprops, nimble install -d |
17:56:52 | madprops | added a way to add them in my argument parser on --help http://i.imgur.com/IZJ6VDa.png |
17:56:57 | madprops | oh 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:50 | FromDiscord | <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:28 | madprops | you mean in the image? |
18:32:46 | FromDiscord | <yewpad> yup |
18:33:33 | FromDiscord | <yewpad> Remove an item: |
18:33:33 | FromDiscord | <yewpad> via name - sym remove movies |
18:33:33 | FromDiscord | <yewpad> via regex - sym remove re:\\w+ |
18:33:44 | FromDiscord | <yewpad> Somethin' like this would do the job |
18:37:26 | * | MnlPhlp joined #nim |
18:39:26 | * | theelous3 joined #nim |
18:45:03 | Araq | mratsim: thanks for reminding me |
18:50:58 | planetis[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:40 | Araq | I took this: https://github.com/alehander92/comprehension/pull/1/files |
18:54:46 | Araq | what's the difference ? |
18:55:37 | * | Guest9275 quit (Ping timeout: 240 seconds) |
18:56:48 | planetis[m] | araq: the one i linked started from your collect macro and I added sets and tables |
18:56:59 | Araq | are you b3liever? |
18:57:32 | planetis[m] | yes |
18:58:03 | planetis[m] | oh you mean the pr I made some time ago |
18:58:15 | planetis[m] | well I developed it further |
18:59:15 | * | NimBot joined #nim |
18:59:39 | planetis[m] | they're almost identical |
18:59:41 | Araq | the only thing I dislike a bit is that it's tied to tables and sets |
19:01:16 | planetis[m] | i dont like it either... especial the ``{v}`` and ``{k: v}`` thing |
19:02:09 | sealmove | hey planetis |
19:02:17 | planetis[m] | at the end of the day I know I will never use this macro, its just fp non-sense |
19:02:42 | planetis[m] | hi sealmove what's up? |
19:02:50 | Araq | hey, bummer ... |
19:03:03 | Araq | I like it very much |
19:03:13 | Araq | as it's FP applied correctly :P |
19:03:22 | Araq | no interim results to optimize away |
19:03:32 | Araq | just turn the statements into an expression |
19:03:40 | sealmove | started 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:51 | Araq | planetis[m], do you happen to have more tests for it? |
19:05:15 | planetis[m] | nope, never used it |
19:05:34 | planetis[m] | sealmove: nice |
19:05:38 | Araq | bah, I suspected you want it badly and used it extensively |
19:07:53 | planetis[m] | hahaha |
19:08:42 | Araq | maybe we also need collectAs(body, initHashSet) |
19:09:05 | planetis[m] | i just wanted to learn how your macro worked that's all :) |
19:09:14 | Araq | or initHashSet.collect(...) |
19:09:54 | * | jjido joined #nim |
19:10:20 | planetis[m] | and what about tables? |
19:10:50 | * | uu91 quit (Ping timeout: 240 seconds) |
19:10:56 | Araq | initTable.collect(...) obviously |
19:11:00 | * | uu91 joined #nim |
19:11:16 | Araq | {k: v} becomes res[k] = v |
19:11:26 | Araq | {v} becomes res.add v |
19:12:17 | planetis[m] | so you still keep the last ``{v}`` |
19:12:53 | planetis[m] | ``initTable.collect(for (i, d) in data.pairs: {i: d})`` ? |
19:13:35 | Araq | I guess so, yes |
19:13:58 | planetis[m] | well let me see what i can do |
19:14:14 | planetis[m] | where will i post it when i'am done? |
19:14:26 | planetis[m] | make a pr in Nim repo? |
19:14:50 | Araq | yeah |
19:15:35 | Araq | extra points if you analyse the body a bit so that the initTable/newSeq call has a nice initial size |
19:15:37 | planetis[m] | ok tomorrow pbl |
19:16:05 | planetis[m] | any examples of that? |
19:16:19 | planetis[m] | strfmt? |
19:18:52 | Araq | sequtils.toSeq attempts to do it |
19:19:03 | Araq | but for 'collect' it needs to be done differently |
19:19:15 | FromGitter | <alehander92> planetis[m] |
19:19:19 | FromGitter | <alehander92> i had an idea for your macro |
19:19:42 | FromGitter | <alehander92> it was to instead do it with a default seq returner and explicit optional type |
19:19:43 | FromGitter | <alehander92> so e.g. |
19:19:47 | FromGitter | <alehander92> collect(...) stuff |
19:19:47 | Araq | for 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:59 | FromGitter | <alehander92> and collectTable (....) |
19:20:07 | FromGitter | <alehander92> `collect[YourCustomType](...)` |
19:20:08 | FromGitter | <alehander92> etc |
19:20:18 | FromGitter | <alehander92> where it just does the same thing it does now |
19:20:36 | FromGitter | <alehander92> but it gets the `adder` and `init` macro code from overloads for the given typeclass |
19:20:50 | Araq | meh, in fact, collect(initTable(lenHint), body) is good enough I suppose |
19:21:22 | Araq | you only need to support partial constructor calls |
19:21:37 | FromGitter | <alehander92> well this isi also an option but then you need to teach it how to "add" |
19:21:51 | FromGitter | <alehander92> my api makes that easier for both the caller and the implementer imo |
19:21:55 | planetis[m] | ok will look araq |
19:21:59 | FromGitter | <alehander92> my proposed api for planetis[m] |
19:22:00 | Araq | ty |
19:22:58 | Araq | or maybe |
19:23:02 | planetis[m] | alehander92: supporting custom types, is a nice thing to do |
19:23:04 | FromGitter | <alehander92> as this collect(<initcode>, body) wouldn't work with a custom collection |
19:23:16 | Araq | course it would |
19:23:18 | planetis[m] | but i want a girlfriend instead :) |
19:23:19 | FromGitter | <alehander92> planetis[m] my point is that if i recall your implementation, it should be very easy to add |
19:23:25 | FromGitter | <alehander92> to your implementation with small changes |
19:23:43 | Araq | the collection all support []= or 'add' depending on the collection |
19:23:50 | FromGitter | <alehander92> i can try to patch it to show what i mean |
19:23:51 | Araq | we have guidelines for this |
19:24:01 | Araq | and because of this. |
19:24:23 | FromGitter | <alehander92> Araq hm, ok, did we have `overloadExists` in macros.nim |
19:24:44 | * | nif quit (Quit: ...) |
19:24:50 | FromGitter | <alehander92> but i see what you mean, one can just assume `[]=` when there are two arguments |
19:24:54 | * | nif joined #nim |
19:25:03 | Araq | someValue # res.add someValue |
19:25:03 | FromGitter | <alehander92> and `add` when there is 1 |
19:25:10 | Araq | {v} # res.incl v |
19:25:17 | Araq | {k: v} # res[k] = v |
19:25:24 | FromGitter | <alehander92> ok, thats great too |
19:25:58 | Araq | {v} as IntSet # with explicit type annotation |
19:26:37 | FromGitter | <alehander92> i think the init thing would benefit from similar convention |
19:26:41 | Araq | might be the best design, so we have nice defaults but it works with any collection |
19:26:44 | FromGitter | <alehander92> something like https://github.com/nim-lang/RFCs/issues/48 |
19:26:48 | Araq | I know |
19:26:55 | Araq | but one step after the other |
19:27:14 | Araq | I think with an optional 'as' it's close to perfect |
19:27:28 | FromGitter | <alehander92> how would `as` look |
19:27:52 | FromGitter | <alehander92> planetis[m] jump next level, directly marry ! |
19:28:19 | planetis[m] | nice will order a bride asap |
19:28:27 | Araq | let stuff = collect: |
19:28:27 | Araq | for k, v in table.pairs(): |
19:28:27 | Araq | {k: v} as SortedTable |
19:29:00 | FromGitter | <alehander92> hmm |
19:29:10 | FromGitter | <alehander92> but wouldnt collect[SortedTable] be more obvious |
19:29:16 | FromGitter | <alehander92> especially to the reader |
19:29:30 | * | Araq shrugs |
19:29:46 | Araq | I like it this way, it's clearly something a bit weird going on |
19:29:48 | FromGitter | <alehander92> and also, if you have `if` you have to repeat two `as` and check if they are compatible |
19:29:57 | Araq | so there is no need to fake generics [] here |
19:30:08 | FromGitter | <alehander92> yeah but you have to look for it deeper inside the expression |
19:30:16 | FromGitter | <alehander92> one can easily miss it imo and say "uh probably a seq" |
19:30:34 | Araq | not really, it's close to the most essential part of the expression |
19:30:44 | FromGitter | <alehander92> well, its almost faking, it basically is "generic" |
19:30:52 | FromGitter | <alehander92> just not using the default generic mechanism :P |
19:31:39 | Araq | but look, there is a difference |
19:31:55 | Araq | collect[Table](...) # Table what? [string, int]? |
19:32:26 | planetis[m] | i like araq last example too |
19:32:33 | Araq | you only pass it a type class anyway |
19:32:52 | FromGitter | <alehander92> well, then it can be collect(typeclass): k |
19:32:58 | planetis[m] | initTable.collect ... not at all |
19:33:14 | FromGitter | <alehander92> this way its more similar to other api-s receiving types |
19:33:22 | Araq | initTable(sizeHintHere).collect(...) |
19:33:24 | FromGitter | <alehander92> like a.to(int) |
19:33:48 | Araq | yeah yeah yeah, the old story, must be consistent with some other random stuff over there. |
19:33:55 | * | Vladar quit (Quit: Leaving) |
19:34:04 | FromGitter | <alehander92> totally not, your objection was |
19:34:06 | Araq | but the size hints are important very often |
19:34:08 | FromGitter | <alehander92> that its not consistent |
19:34:14 | FromGitter | <alehander92> i didnt care much |
19:34:20 | Araq | so maybe we should focus on them |
19:34:28 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:34:44 | Araq | otherwise 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:40 | FromGitter | <alehander92> well, this is almost the same as my idea then |
19:35:57 | FromGitter | <alehander92> my thing would be just `collect(typ.myinit):` |
19:35:58 | FromGitter | <alehander92> instead |
19:36:14 | planetis[m] | so make it ``{k: v} as SortedTable(64)`` |
19:36:22 | Araq | ah so now it's *your* idea :P |
19:36:37 | Araq | anyway, we have 2 questions here: |
19:36:49 | FromGitter | <alehander92> my mini idea was only using `typeclass` as arg :P |
19:36:54 | Araq | * type part of collect or inside the collect |
19:37:02 | Araq | * type or init call |
19:38:01 | Araq | since 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:22 | FromGitter | <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:17 | planetis[m] | i guess inferring the init call from the type is bad, right? |
19:40:46 | FromGitter | <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:51 | Araq | planetis[m], not sure, but it's fine to assume an idiomatic nim API |
19:41:04 | FromGitter | <alehander92> planetis i think its best but it needs an implemented RFC |
19:41:43 | Araq | I think new experimental syntax sugar doesn't need a fullblown RFC |
19:42:00 | * | jjido joined #nim |
19:42:34 | FromGitter | <alehander92> i meant the standard `init` for all kinds of types thing |
19:42:42 | Araq | oh |
19:42:43 | FromGitter | <alehander92> but yeah probably fine to assum |
19:42:44 | Araq | I see |
19:44:04 | Araq | the verbs are clear at least, it's add, incl and []= |
19:44:18 | planetis[m] | yes you can't assume if ``SomeType`` is ref or plain object |
19:44:27 | Araq | notice that sets and intsets.nim do use 'incl' and *not* 'add' |
19:44:34 | Araq | for better or worse... |
19:44:56 | FromGitter | <alehander92> planetis[m] but you can check that |
19:45:00 | FromGitter | <alehander92> on macro time iirc |
19:45:24 | Araq | ah your macro already uses 'incl', nice |
19:45:40 | planetis[m] | ok ``initTable(sizeHintHere).collect(...)`` it is for me, I wonder what you guys will settle to |
19:45:48 | Araq | and don't bindSym these so that the macro implementation doesn't import these modules |
19:46:26 | FromGitter | <alehander92> hmm, now i wonder something else, can we collect into an existing variable |
19:46:30 | FromGitter | <alehander92> or would that be too much |
19:46:41 | planetis[m] | yes |
19:46:46 | Araq | we can't, we rely on the move optimizer |
19:46:59 | Araq | good that it's part of the spec now |
19:47:10 | Araq | (and that it actually works...) |
19:47:41 | FromGitter | <alehander92> so if i have a = collect .. it might be possible to directly do the allocation/.add on `a` ? |
19:47:43 | planetis[m] | that's another nice option saves as from some trouble |
19:48:00 | FromGitter | <alehander92> hm, but it cant possibly know if `a` is already allocated |
19:48:19 | FromGitter | <alehander92> but thats a pretty niche case |
19:48:57 | Araq | alehander42: the macro cannot see the 'let x = macroHere' part |
19:49:10 | planetis[m] | oh I was thinking ``var a = initTable[string, int](64); collect(a): for ..`` |
19:49:12 | Araq | macros can only influence what's passed to them |
19:49:33 | Araq | well that misses the point |
19:49:33 | FromGitter | <alehander92> Araq yes i thought about copy ellision or something like that |
19:49:42 | FromGitter | <alehander92> yes i meant what planetis[m] shows |
19:49:45 | Araq | we have copy ellision, relax. |
19:49:49 | FromGitter | <alehander92> i imagined collect(initcode, body) => collect(var collection, body) |
19:49:57 | Araq | that misses the point! |
19:50:13 | Araq | if it's not an expression, it doesn't *do* anything whatsoever then |
19:50:39 | FromGitter | <alehander92> i see |
19:51:08 | planetis[m] | ^ see what i meant, i dont even understand fp |
19:51:30 | Araq | you do understand FP. turn stuff into expressions. that's FP. |
19:52:02 | FromGitter | <alehander92> i learned `no allocations good` and now i forgot to fp |
19:53:56 | FromGitter | <alehander92> well so `collect(initCode, code) and `collect(code) #inferring seq/set/table by default` |
19:55:57 | FromGitter | <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:09 | FromGitter | <alehander92> it might be confusing inside the body |
19:57:31 | * | Araq sighs |
19:57:51 | Araq | pure speculation. and it would have to be an 'as' that doesn't really return a value |
19:58:05 | Araq | I'll be dead before that becomes a real problem |
19:58:30 | Araq | in fact, I have yet to see an overloaded 'as' operator. |
19:58:37 | planetis[m] | i thing araq wants to avoid infering as this means it will have to import sets/tables |
19:58:57 | Araq | don't import sets/tables, that would be a closed design |
19:59:13 | Araq | in fact, currently your macro doesn't work with intsets as far as I can tell |
19:59:28 | Araq | and we're getting new collection types (narimiran's sorta) |
20:01:02 | clyybber | sorta? |
20:01:42 | narimiran | clyybber, that's what you get when i don't want to spend any time on thinking about names :P |
20:01:53 | FromGitter | <alehander92> Araq it is still possible, no reason imo when one can just not mess with the code block |
20:02:04 | clyybber | narimiran: sorta cool |
20:02:26 | clyybber | narimiran: but what is it? |
20:02:29 | planetis[m] | narimiran: what did you have in mind when you thought this name? |
20:02:35 | narimiran | SORted TAbles |
20:02:38 | FromGitter | <alehander92> planetis hm, i so how would it work for sets |
20:02:38 | clyybber | sorta something |
20:02:52 | FromGitter | <alehander92> if no inferring |
20:04:18 | FromGitter | <alehander92> Araq anyway, the init thing, it needs another assumption |
20:04:27 | planetis[m] | alehander the ``{v}`` thing translates to ``a.incl d`` |
20:05:06 | planetis[m] | plain ``v`` to add |
20:05:09 | FromGitter | <alehander92> planetis[m] i mean inferring initSet |
20:05:20 | FromGitter | <alehander92> that <function>(<args>) should be converted to <function><type> (<args>) <= Araq |
20:05:57 | FromGitter | <alehander92> e.g. initTable(size) => initTablekey, value (size) |
20:06:15 | FromGitter | <alehander92> probably its a fine assumption |
20:06:20 | Araq | yeah so your lovely typedesc based inits don't work :P |
20:06:25 | FromGitter | <alehander92> yeaah :( |
20:06:54 | * | narimiran quit (Quit: leaving) |
20:07:13 | Araq | the only problem with initTable(90).collect is that it's not convenient enough |
20:07:46 | FromGitter | <alehander92> you can have collect(size, code) overload |
20:08:01 | FromGitter | <alehander92> which just calls those inits with size |
20:08:09 | FromGitter | <alehander92> custom types just add their full init code |
20:08:17 | FromGitter | <alehander92> or support such an overload |
20:08:46 | * | narimiran joined #nim |
20:09:24 | Araq | unfortunately in today's Nim 'untyped' bites overloading |
20:09:54 | Araq | it really bites back |
20:09:57 | FromGitter | <alehander92> well it doesnt need to be real overload |
20:10:14 | FromGitter | <alehander92> hmm it kinda does sometimes |
20:10:32 | FromGitter | <alehander92> because initCode can't be `typed` ok |
20:13:50 | FromGitter | <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:21 | FromGitter | <alehander92> otherwise newStringstring (50) |
20:15:30 | FromGitter | <alehander92> another option is to just assume `K` `V` and `T` similar to `it` in mapIt |
20:15:32 | FromGitter | <alehander92> for initCode |
20:15:40 | FromGitter | <alehander92> and support `collect(initTable[K, V](50)` |
20:16:00 | FromGitter | <alehander92> but this would be confusing in already generic functions, i know, horrible overengineering |
20:17:39 | * | rockcavera joined #nim |
20:20:55 | planetis[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:19 | FromDiscord | <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:27 | FromDiscord | <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:57 | Zevv | !eval echo @[10, 30, 70].find(30) != -1 |
21:04:01 | NimBot | true |
21:05:10 | Zevv | echo @["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:23 | FromDiscord_ | <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:17 | FromDiscord | <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:36 | shashlick_ | 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:35 | Zevv | the !eval part is to let nimbot run the code |
21:28:52 | Zevv | the find() function returns the index of the element you are looking for, or -1 if it is not found |
21:29:08 | Zevv | does that make sense? |
21:29:53 | FromGitter | <topcheese> I was going to guess not equal to the end of the seq. Oh well. |
21:30:33 | Zevv | -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:58 | FromDiscord_ | <trey.merkley> okay, so building off of that |
21:47:32 | Araq | use 'find() < 0' for smaller code size |
21:48:18 | FromDiscord_ | <trey.merkley> var = 30 |
21:49:02 | * | tane quit (Quit: Leaving) |
21:49:05 | FromDiscord_ | <trey.merkley> if @[10,30,70].find(var) |
21:49:05 | FromDiscord_ | <trey.merkley> return var |
21:49:20 | FromDiscord_ | <trey.merkley> would be how it works right? |
21:49:42 | Zevv | !eval 30 in @[10, 30, 70] |
21:49:44 | NimBot | Compile failed: /usercode/in.nim(1, 4) Error: expression 'contains(@[10, 30, 70], 30)' is of type 'bool' and has to be discarded |
21:50:02 | Zevv | !eval echo 30 in @[10, 30, 70] |
21:50:06 | NimBot | true |
21:50:22 | Zevv | or like that |
21:50:31 | FromDiscord_ | <trey.merkley> okay, neat, thanks |
21:56:13 | Araq | or you use 'contains' |
21:56:50 | ZZZtyZ | discard result or assign it to a variable and use it |
21:59:09 | ZZZtyZ | discard contains(@[10, 30, 70], 30) |
21:59:09 | ZZZtyZ | echo contains(@[10, 30, 70], 30) |
21:59:09 | ZZZtyZ | var 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:21 | madprops | what's a better way to do this? https://play.nim-lang.org/#ix=22td |
22:14:32 | madprops | keys seems to be an iterator only |
22:14:51 | * | ZZZtyZ quit (Quit: leaving) |
22:17:51 | FromDiscord_ | <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:03 | FromDiscord_ | <yewpad> Because this feels waayyyyyyy to hacky: https://github.com/blockleague/2tools/blob/master/toTools.nimble#L16 |
22:18:11 | FromDiscord_ | <yewpad> I need alternatives |
22:22:32 | FromDiscord_ | <yewpad> And I don't want to create a bunch of GitHub repositories for every single tool. |
22:23:29 | FromDiscord_ | <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:52 | Mike[m]7 | Hey, 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:13 | Mike[m]7 | Nim puts the enums into 1 byte, for example, but vulkan is expecting them to be 8 |
22:30:52 | * | ltriant joined #nim |
22:34:04 | Araq | add .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:53 | dom96 | CfP deadline for FOSDEM is in 5 days: https://forum.nim-lang.org/t/5577 |
22:39:54 | dom96 | Araq, @zah, @mratsim, yglukhov[m], ^^ |
22:40:12 | dom96 | Ping anyone else who you'd like to encourage to submit a talk ;) |
22:42:41 | Mike[m]7 | Araq: 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:26 | FromDiscord_ | <yewpad> Am I the only one where 'after' and 'before' blocks won't get called by nimble? |
22:54:17 | FromDiscord_ | <yewpad> Like 'after build:' doesn't get called |
22:54:37 | clyybber | Mike: Just a heads up, I made a vulkan binding https://github.com/Clyybber/vulkanim |
22:57:02 | Mike[m]7 | Have 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:33 | clyybber | I didn't have any issues, but I also didn't try nimgl's bindings |
22:58:18 | Mike[m]7 | Cool, 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:51 | clyybber | Mike: If you do, I'll be glad to help |
23:00:58 | Mike[m]7 | Awesome, thank you. I'll probably start playing with it tonight |
23:02:26 | * | Hideki_ joined #nim |
23:04:20 | FromDiscord_ | <yewpad> |
23:04:20 | FromDiscord_ | <yewpad> https://cdn.discordapp.com/attachments/371759389889003532/647210715773534227/unknown.png |
23:04:28 | FromDiscord_ | <yewpad> I can't even overwrite the task itself |
23:04:36 | FromDiscord_ | <yewpad> It doesn't print jackshit |
23:06:15 | clyybber | yewpad: Try changing the second line to `echo "jackshit"` |
23:07:13 | * | Hideki_ quit (Ping timeout: 265 seconds) |
23:07:21 | clyybber | jk, is that nimble or nake? |
23:07:25 | FromDiscord_ | <yewpad> nimble |
23:08:03 | clyybber | hmm, maybe ask dom96 about it |
23:08:05 | FromDiscord_ | <yewpad> https://play.nim-lang.org/#ix=22tr |
23:08:24 | FromDiscord_ | <yewpad> https://play.nim-lang.org/#ix=22ts |
23:08:44 | FromDiscord_ | <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:22 | dom96 | you can't overwrite built-in commands like this right now IIRC |
23:35:37 | FromDiscord_ | <yewpad> Geez |
23:35:39 | FromDiscord_ | <yewpad> fine then |
23:35:46 | madprops | is 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:43 | FromGitter | <deech> Found a mascot https://en.wikipedia.org/wiki/Nim_Chimpsky |