00:11:38 | FromGitter | <yyyc514> any easy way to speed up or do cached/increment builds? I know it’s already doing SOME of that… any way i can get more visibility into the process? |
00:12:37 | FromGitter | <kayabaNerve> It checks if the file was altered; if not, it doesn't recompile it; it always links it ofc. The files are stored in the `nimcache`. |
00:13:48 | FromGitter | <yyyc514> yeah i don’t think the linking is taking any time :) |
00:13:51 | FromGitter | <kayabaNerve> If you don't specify the `nimcache`, it's now under `~/.cache/nim` IIRC (on Linux and Mac) |
00:13:57 | FromGitter | <kayabaNerve> You wanted insight :P |
00:14:16 | FromGitter | <kayabaNerve> You can specify `-f` to force rebuild |
00:26:22 | FromGitter | <yyyc514> i don’t think it’s cahcing the C generation part |
00:27:19 | FromGitter | <yyyc514> hmmm, ok it’s not rebuilding the C files randomly but it’s still doing a lot of work |
00:29:51 | FromDiscord | <smitop> i'm trying to use opengl with nim. i'm trying to use a uniform to set the color based on the time |
00:29:51 | FromDiscord | <smitop> but i get https://pastebin.com/24CWP5nW when i call ``glUniform4f`` |
00:57:49 | * | zachk quit (Quit: Leaving) |
01:06:25 | FromDiscord | <treeform> I do a ton of openGL with nim |
01:06:27 | FromDiscord | <treeform> let me see |
01:06:52 | FromDiscord | <treeform> what is the value of "vertexColorLocation" |
01:06:58 | FromDiscord | <treeform> its probably -1 or other invalid value |
01:07:21 | FromDiscord | <treeform> Are you sure "ourColor" maybe you wanted "outColor" ? |
01:08:17 | FromDiscord | <treeform> @smitop |
01:09:31 | FromDiscord | <smitop> vertexColorLocation is 0 |
01:09:48 | FromDiscord | <smitop> ou*r*Color is correct |
01:10:47 | * | vlad1777d_ quit (Ping timeout: 240 seconds) |
01:16:07 | * | abm quit (Ping timeout: 240 seconds) |
01:17:32 | * | joibll quit (Quit: Page closed) |
01:26:55 | * | platoff quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
01:54:02 | FromGitter | <yyyc514> hmmm |
02:05:01 | * | banc quit (Quit: ZNC - http://znc.in) |
02:22:25 | * | banc joined #nim |
02:29:49 | * | bozaloshtsh quit (Quit: ZNC 1.7.0 - https://znc.in) |
02:32:19 | * | bozaloshtsh joined #nim |
02:32:19 | * | bozaloshtsh quit (Changing host) |
02:32:20 | * | bozaloshtsh joined #nim |
02:33:32 | * | endragor joined #nim |
02:58:38 | FromGitter | <citycide> is it possible to put compile-time constraints on FFI imports? like an arg is a `cstring` but must be one of 4 specific strings? |
02:59:14 | FromGitter | <citycide> or do I have to make a wrapper of some kind to do it |
03:05:15 | FromGitter | <citycide> similar question for `{.varargs.}` on an FFI import, does it always allow everything or can you constrain it to a specific type? `{.varargs: int.}` would be cool |
03:09:52 | * | smt quit (Read error: Connection reset by peer) |
03:11:05 | leorize | citycide: I think you could just add a `varargs` param at the end yourself |
03:11:29 | leorize | the `varargs` pragma is just for the C-style untyped `varargs` I think |
03:12:35 | FromGitter | <citycide> leorize: I couldn't get that to pass anything but an array in the generated code |
03:12:43 | FromGitter | <citycide> (javascript) |
03:27:58 | * | smt joined #nim |
03:29:47 | * | chemist69_ quit (Ping timeout: 250 seconds) |
03:31:50 | * | chemist69 joined #nim |
03:38:24 | * | dddddd quit (Remote host closed the connection) |
03:59:39 | * | smt quit (Read error: Connection reset by peer) |
04:11:13 | * | kapil____ joined #nim |
04:16:08 | FromGitter | <gogolxdong> How to make this right? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bcff2081e23486b930ac8d5] |
04:17:13 | * | narimiran joined #nim |
04:19:32 | FromGitter | <gogolxdong> and basically how to read symbols of a dynlib? |
04:27:06 | FromGitter | <gogolxdong> Somebody uses imm32.dll in Nim? I found sdl2 uses . |
04:30:42 | FromGitter | <gogolxdong> chrome uses imm32.dll directly. |
04:49:57 | * | stefanos82 joined #nim |
05:06:48 | FromGitter | <vegai> if I wanted to compete with this https://github.com/cart/amethyst-bunnymark, is there any library you would suggest? |
05:07:51 | FromGitter | <vegai> it’s a data-driven game engine |
05:11:05 | FromGitter | <vegai> mm, perhaps that’s a silly question anyway |
05:15:22 | FromGitter | <vegai> perhaps an implementation on godotnim would be interesting |
05:20:25 | leorize | gogolxdong: on linux you could use `nm -D`, I don't know about Windows however |
05:20:54 | leorize | but usually you'd create functions based on their header files, not the symbols themselves |
05:26:28 | * | leorize quit (Ping timeout: 264 seconds) |
05:31:40 | FromGitter | <gogolxdong> there is loadLib() in dynlib module, can be used for symbols validation. |
05:37:59 | * | nsf joined #nim |
05:40:19 | * | darithorn quit () |
05:41:17 | FromGitter | <vegai> by the way, how long has nim had async support? |
05:41:45 | FromGitter | <vegai> in its current form, I mean. Async/await. |
05:51:19 | FromDiscord | <2vg> async/await style supported |
05:52:16 | * | leorize joined #nim |
05:53:19 | * | Vladar joined #nim |
06:00:33 | * | narimiran quit (Quit: Konversation terminated!) |
06:03:14 | * | xet7 quit (Remote host closed the connection) |
06:04:53 | * | xet7 joined #nim |
06:06:39 | * | xet7 quit (Remote host closed the connection) |
06:07:12 | * | xet7 joined #nim |
06:32:22 | * | d10n quit (Quit: why all the #hashtags #lol #hackers #overheard) |
06:32:36 | * | d10n joined #nim |
06:32:36 | * | d10n quit (Changing host) |
06:32:36 | * | d10n joined #nim |
06:33:16 | * | xet7 quit (Read error: Connection reset by peer) |
06:44:46 | * | xet7 joined #nim |
06:45:55 | * | Vladar quit (Remote host closed the connection) |
07:00:12 | * | mech422__ joined #nim |
07:02:01 | * | xet7 quit (Remote host closed the connection) |
07:03:55 | * | mech422_ quit (Ping timeout: 268 seconds) |
07:04:00 | * | PMunch joined #nim |
07:06:47 | * | sagax_ joined #nim |
07:09:52 | * | xet7 joined #nim |
07:30:41 | * | shadowbane quit (Remote host closed the connection) |
07:31:09 | * | shadowbane joined #nim |
07:31:17 | * | jjido joined #nim |
07:39:41 | * | gmpreussner quit (Ping timeout: 268 seconds) |
07:39:57 | * | jjido quit (Ping timeout: 252 seconds) |
07:46:10 | * | tiorock joined #nim |
07:46:10 | * | tiorock quit (Changing host) |
07:46:10 | * | tiorock joined #nim |
07:46:10 | * | rockcavera is now known as Guest48321 |
07:46:10 | * | Guest48321 quit (Killed (tolkien.freenode.net (Nickname regained by services))) |
07:46:11 | * | tiorock is now known as rockcavera |
07:46:18 | * | gmpreussner joined #nim |
07:47:17 | * | jjido joined #nim |
07:50:10 | FromGitter | <narimiran> good morning, anybody here? |
07:51:27 | * | jjido quit (Ping timeout: 240 seconds) |
07:54:15 | FromGitter | <alehander42> y |
07:56:07 | FromGitter | <narimiran> just the right man to ask about macros :) |
07:56:57 | FromGitter | <narimiran> can you tell me why line 8 doesn't work? http://ix.io/1pUi/nim (so we must introduce `b0` and `b1`? |
07:59:48 | snowolf | Quick and not particularly brilliant question (well hopefully): any straightforward way of setting up a memoized procedure that might be called from within a spawn'ed procedure? |
08:00:57 | snowolf | (I get a Error: 'spawn' takes a GC safe call expression when I just try w/ either the macro or the memoize function from the 'memo' package) |
08:00:57 | FromGitter | <alehander42> @narimiran oh yeah this doesn't work |
08:00:59 | FromGitter | <alehander42> not sure why |
08:01:16 | FromGitter | <alehander42> but I just always assign <node>[<index>] |
08:01:35 | FromGitter | <alehander42> like you these days, maybe there is another workaround |
08:01:38 | * | abm joined #nim |
08:04:15 | FromGitter | <narimiran> it's a gotcha that took me quite long to "debug" |
08:04:56 | Araq | snowolf: use a .thread variable |
08:06:07 | Araq | narimiarn: news! quoting sucks :-) |
08:07:47 | FromGitter | <narimiran> Araq: i deny to believe it! i just recently discovered quoting and it is like magic! |
08:08:00 | FromGitter | <narimiran> but i guess the magic wears off after some time.... |
08:08:22 | * | krux02 joined #nim |
08:08:52 | FromGitter | <narimiran> i'm impressed that i can do quote onliner (plus some extra unexpected work here) which replaces a whole screen of `dumpAstGen`-generated code |
08:18:36 | PMunch | narimiran, quote has some gotchas but I agree that it's great in general! |
08:24:37 | FromGitter | <mratsim> without quoting my macros would be much bigger |
08:26:09 | PMunch | It's still a shame that my PR to allow result in quote didn't get merged though |
08:26:16 | PMunch | I think that's one of the more common gotchas |
08:28:22 | FromGitter | <mratsim> unquoted result (from proc) is a gotcha, but why wasn’t it accepted? |
08:29:13 | * | chemist69 quit (Ping timeout: 250 seconds) |
08:30:03 | * | chemist69 joined #nim |
08:31:05 | PMunch | https://github.com/nim-lang/Nim/pull/7343, zah didn't like how it worked |
08:32:18 | FromGitter | <mratsim> yeah, I agree with him, you are fixing the symptoms not the problem |
08:53:30 | * | dom96_w joined #nim |
08:54:09 | * | dom96_w quit (Client Quit) |
08:55:05 | * | dom96_w joined #nim |
08:58:01 | PMunch | Sure, but it's a fix, and it worked. There are no other symptoms of this problem with regards to quote, and Araq said it would be a PITA to fix properly |
08:59:05 | PMunch | Better to have a working system with a tiny workaround than a broken system without any fix in sight. |
09:02:46 | * | leorize quit (Ping timeout: 272 seconds) |
09:25:20 | Araq | PMunch, I agree and will merge your PR |
09:28:59 | PMunch | Really? Neat, then I can remove the exact same work-around that I've manually applied everywhere I needed the result variable in a quote :) |
10:21:20 | FromGitter | <mratsim> ugh, that’s how C++ got build :P |
10:21:36 | FromGitter | <mratsim> “small patches” becomes permanent fixes |
10:25:54 | * | anamok joined #nim |
10:25:56 | anamok | hi |
10:26:43 | anamok | When working with a hash table, should I use Table or TableRef? Say I don't want to make a copy of it, I just want to fill it and use it? Should I prefer one of them? |
10:27:15 | anamok | ...fill it and use it. (dot) |
10:27:52 | * | Vladar joined #nim |
10:28:47 | anamok | As I understood, Table is created on the stack, while TableRef is on the heap. If the table is too big, maybe TableRef would be a better choice? |
10:34:52 | FromGitter | <mratsim> well, actually both are created on the heap but one has value semantics while the other has ref semantics |
10:35:34 | FromGitter | <mratsim> so the only question you need to ask your self is how do I want them to behave on assignment |
10:36:45 | anamok | Thanks. I thought everything that used value semantics was on the stack. |
10:37:41 | FromGitter | <mratsim> strings and seq have value semantics but are on the heap |
10:38:34 | FromGitter | <mratsim> unfortunately since assignment overloading is broken there is no way to implement efficient value semantics for custom ref types at the moment. |
10:42:28 | anamok | If I want to pass a table to a proc, I think a TableRef would be cheaper since only the reference would be copied, while in the case of a Table the whole table is copied. Is that right? |
10:45:11 | * | platoff joined #nim |
10:58:26 | FromGitter | <mratsim> no, Nim wil do the right thing™ |
10:58:52 | Araq | it is not broken |
10:59:01 | Araq | '=' for objects works and everything else shouldn't |
10:59:07 | FromGitter | <mratsim> stack objects that are too big will be passed by hidden ref |
11:00:30 | * | platoff quit (Read error: Connection reset by peer) |
11:00:49 | FromGitter | <mratsim> @Araq, well that’s what you said: https://github.com/nim-lang/Nim/issues/6348#issuecomment-334920427 |
11:02:49 | Araq | I said that one year ago and afterwards I closed it.... |
11:02:54 | Araq | seriously... |
11:13:57 | FromGitter | <yyyc514> where did fsmonitor go? |
11:15:52 | FromGitter | <yyyc514> guess it’s old? |
11:16:46 | * | dom96_w quit (Changing host) |
11:16:46 | * | dom96_w joined #nim |
11:16:56 | dom96_w | It was never cross-platform |
11:20:27 | dom96_w | mratsim: Table isn't stored on the heap, its contents might be, but it's not. |
11:21:46 | FromGitter | <mratsim> I’m pretty sure @anamok was talking about the content |
11:24:44 | anamok | If I create a simple table, say {1: "one", 2: "two"} and I make it a Table and a TableRef, then what's the difference? Where are they stored? I was curious to know this. |
11:26:07 | dom96_w | Frankly, I can't really see a reason to use TableRef. |
11:26:34 | dom96_w | So I'm curious why we even have it now |
11:29:09 | FromGitter | <yyyc514> ok anyone have any advice on file watching on OS X? |
11:29:15 | FromGitter | <yyyc514> fs-watch seems to compile but crash : |
11:32:58 | FromGitter | <alehander42> tup http://gittup.org/tup/ is amazing on linux |
11:33:13 | FromGitter | <alehander42> it should support osx, but I haven't used it there |
11:35:18 | FromGitter | <yyyc514> not a nim thing? |
11:35:33 | FromGitter | <yyyc514> was looking for something in the nim ecosystem to seamless pair with my framework for hot reloading |
11:36:31 | FromGitter | <alehander42> it's hm, stack-agnostic |
11:36:47 | FromGitter | <alehander42> i use it for a big nim project |
11:37:10 | FromGitter | <alehander42> what do you use for hot reloading? |
11:37:20 | FromGitter | <yyyc514> nothing yet :) just built it each time |
11:37:33 | FromGitter | <yyyc514> could look into dll stuff but not sure that’d help much |
11:38:19 | FromGitter | <yyyc514> i tried facebooks thing but it was too complex |
11:38:56 | FromGitter | <alehander42> work on reloading is underway ( https://github.com/nim-lang/Nim/issues/8927 ) |
11:39:55 | FromGitter | <yyyc514> yes i heard |
11:40:44 | FromGitter | <yyyc514> no idea what i’m doing wrong with fs-watch |
11:41:01 | FromGitter | <yyyc514> SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
11:41:38 | * | jjido joined #nim |
11:42:04 | * | ajhidd joined #nim |
11:42:13 | planetis[m] | so does nested objects with destructors work now? or would be better to fill a bug report? |
11:44:45 | ajhidd | Hi o/ Just a quick question: can I do something like `let next = system.inc[int]`? |
11:46:43 | anamok | yyyc514: it happens to me when I switch from debug mode to release mode. In release mode bound checks are off. |
11:47:02 | planetis[m] | system.inc doesn't have a generic parameter |
11:47:37 | planetis[m] | and this syntax doesn't compile |
11:48:08 | * | ryuo quit (Quit: WeeChat 1.9.1) |
11:48:18 | planetis[m] | you need to write x.inc[:int] |
11:49:57 | planetis[m] | ajhidd: maybe you want to use a cast? then it: cast[int](x) |
11:50:01 | FromGitter | <yyyc514> anamok: nope i’m in debug mode |
11:50:19 | ajhidd | planetis[m]: Actually what I want is the ability to assign a proc to a variable based on some condition |
11:50:52 | ajhidd | planetis[m]: Something like `let next = if cond: inc else: dec` |
11:51:02 | anamok | Going to lunch. Bye. |
11:51:08 | ajhidd | planetis[m]: Wonder if it's possible in nim |
11:51:10 | * | anamok quit (Remote host closed the connection) |
11:51:33 | planetis[m] | yes it is never used this kind of logic though |
11:51:56 | planetis[m] | then you call it |
11:52:13 | * | smt joined #nim |
11:52:16 | planetis[m] | ```let x = inc; next = x()``` |
11:52:25 | planetis[m] | with the `()` |
11:52:44 | FromGitter | <yyyc514> well not impressed with my first c integration experience :) |
11:52:47 | * | jjido quit (Ping timeout: 240 seconds) |
11:55:16 | FromGitter | <yyyc514> x_Ih4hI0OoPxx88jhmtra0qw = Dl_277579_(handle_Jzj2vS0PJtCaXof8uG2JJw, nimToCStringConv(directory_to_watch_tyyj6lJv5LTKxoIgk88wqQ)); |
11:55:21 | FromGitter | <yyyc514> broken cstring conversion? |
11:55:27 | ajhidd | planetis[m]: thanks, I'll try this one |
11:55:54 | FromGitter | <yyyc514> it wants a string pointer, do i have to do anything special in nim to get that? |
11:56:16 | FromGitter | <yyyc514> the generated nim code is “cstring" |
11:56:32 | FromGitter | <yyyc514> the source is `const char * path` |
11:58:05 | planetis[m] | glad I could help |
12:00:44 | FromGitter | <yyyc514> ok cstring does not want a ref string |
12:00:50 | * | vlad1777d_ joined #nim |
12:00:58 | planetis[m] | wait a minute should I write a destructor for the object that encapsulates? How is this supposed to work? |
12:01:21 | FromGitter | <yyyc514> anyc hance this could be a nim isse? |
12:01:30 | FromGitter | <yyyc514> the examples are trivial, feel like i’m doing it righ |
12:03:53 | FromGitter | <alehander42> Araq, are imported deps subject to DCE |
12:04:01 | planetis[m] | also if I have a `lent Foo` parameter, can I copy it with an assignment? |
12:04:19 | FromGitter | <alehander42> e.g. if I import <lib> which I use only in function f, but I don't have a call to f in a compiled program, would <lib> be eliminat |
12:05:41 | planetis[m] | I have made a custom filestream and csv parser, hope to turn it into a macro |
12:17:44 | FromGitter | <alehander42> i am now convinced, orm-s might be overrated, but raw sql serialization/deserialization is absolute pita |
12:19:06 | planetis[m] | nevermind it seems it works now great! |
12:20:08 | planetis[m] | destructors are so cool, I wish conecpts worked |
12:20:15 | planetis[m] | *concepts |
12:23:11 | FromGitter | <alehander42> strange, the only orm lib for the last several years is ormin |
12:23:43 | FromGitter | <alehander42> the new type field macros might be useful for something like th |
12:24:21 | dom96_w | yyyc514: what |
12:24:29 | dom96_w | *what's facebook's thing? |
12:28:45 | FromGitter | <yyyc514> 1609 if (this->__end_ < this->__end_cap()) |
12:28:47 | FromGitter | <yyyc514> ugh |
12:28:51 | FromGitter | <yyyc514> i dunno some file montior thingy |
12:29:10 | FromGitter | <yyyc514> sos maybe session-paths isn’t setup right? |
12:29:32 | FromGitter | <yyyc514> but i cann init_session |
12:29:34 | FromGitter | <yyyc514> i give up |
12:31:38 | FromGitter | <AchalaSB> What is the webassembly interpreter for Nim? To convert from JS to wasmi |
12:32:05 | FromGitter | <vegai> @yyyc514 damn, that’s cool! I saw that issue earlier, but I figured it’s one of those ideas that never will got worked on |
12:32:26 | FromGitter | <yyyc514> which idea? |
12:32:46 | FromGitter | <vegai> https://github.com/nim-lang/Nim/issues/8927 — hot code reloading & REPL |
12:36:26 | * | Vladar quit (Remote host closed the connection) |
12:59:57 | shashlick | Yay https://nim-lang.github.io/Nim/nimc.html#cross-compilation-for-windows |
13:02:01 | FromGitter | <alehander42> nice |
13:03:16 | FromGitter | <zetashift> @endragor you there by any chance? |
13:04:40 | * | rockcavera quit (Ping timeout: 268 seconds) |
13:05:06 | endragor | zetashift: hi |
13:05:56 | * | ajhidd quit (Quit: Я уже ушел. Fui. (c)) |
13:08:38 | * | endragor quit (Remote host closed the connection) |
13:10:51 | FromGitter | <zetashift> I'm having trouble with the autoload singleton in godot: https://github.com/pragmagic/godot-nim/issues/38, getting recursive dependency errors, what would be a nim way to set the current gamestate and player lives etc without introducing a 'Global' singleton? |
13:11:08 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
13:21:56 | * | vlad1777d_ quit (Ping timeout: 268 seconds) |
13:25:28 | Araq | alehander42, DCE doesn't care, what is not used is optimized out |
13:31:37 | FromGitter | <alehander42> yeah, it makes sense |
13:31:39 | FromGitter | <alehander42> ok |
13:33:00 | * | endragor joined #nim |
13:38:55 | * | craigger_ quit (Read error: Connection reset by peer) |
13:39:18 | * | poopBot joined #nim |
13:39:30 | * | craigger joined #nim |
13:39:55 | poopBot | PMunch, hmm newibe question, but for @r.defaultSize=(200,200); how to pass size cuz atm its complaining i am passing an tuple insted 2 cints |
13:40:42 | PMunch | What's the actual error message? |
13:41:33 | poopBot | PMunch, type mismatch: got <Window, tuple of (int, int)> |
13:41:33 | poopBot | but expected one of: |
13:41:33 | poopBot | proc defaultSize=(window: Window; width: cint; height: cint) |
13:41:33 | poopBot | first type mismatch at position: 2 |
13:41:33 | poopBot | required type: cint |
13:41:33 | poopBot | but expression '(200, 200)' is of type: tuple of (int, int) |
13:41:35 | poopBot | expression: defaultSize=(:tmp427037, (200, 200)) |
13:42:04 | PMunch | Uhm, that's a bug in the gtk3 module :P |
13:42:12 | poopBot | oh |
13:42:35 | PMunch | You could try @r.`defaultSize=`(200, 200) |
13:42:50 | poopBot | i tryed like 200; 200; . ((200),(200)) and like 20 other ways xD |
13:42:56 | poopBot | will try |
13:43:40 | PMunch | or @r.setDefaultSize(200, 200) |
13:44:31 | poopBot | hmm |
13:44:58 | PMunch | The defaultSize= procedure should've been defined in another way |
13:45:02 | PMunch | To accept e.g. a tuple :P |
13:45:20 | * | craigger quit (Read error: Connection reset by peer) |
13:46:02 | * | craigger joined #nim |
13:46:07 | poopBot | setDefaultSize worked |
13:46:13 | PMunch | Yay :) |
13:46:35 | PMunch | How do you like genui so far? |
13:46:54 | FromGitter | <kaushalmodi> PMunch: someone here had once mentioned a library about handling floating points; about the issue where parsetoml prints 0.030000000001 instead of 0.03. |
13:47:10 | poopBot | @r << is reference to root window, a am just diving in i spend 2 days trying to figure out what window types and stuff i have to use in GTK to achive what i want using Glade |
13:47:31 | FromGitter | <kaushalmodi> May be someone reading this knows what library I'm talking about and can point to it. |
13:49:09 | PMunch | poopBot, not quite @r, or @result is the name of the widget created on that line |
13:49:35 | poopBot | yep just found it in docs |
13:49:46 | poopBot | ctrl+F to the resque xD |
13:50:21 | * | leorize joined #nim |
13:51:06 | PMunch | Can be sued to store the widget in a variable for later as well |
13:51:12 | FromGitter | <kaushalmodi> Araq: I think you had shared a gist of your library called "decimal" or something like that? (Ref: my above message about 0.03) |
13:51:29 | poopBot | yep i think i saw that allready in docs somwere |
13:51:38 | PMunch | kaushalmodi, well TOML specifies that floating point numbers should be a double precision float IIRC |
13:51:45 | PMunch | Which is what it is in parsetoml |
13:54:31 | * | narimiran joined #nim |
13:55:21 | Araq | https://gist.github.com/Araq/c71b764b94188337b24c6180b239229d here it is again |
13:55:35 | Araq | but somebody turned this into Nimble package already iirc/I hope |
13:56:15 | FromGitter | <kaushalmodi> PMunch: why would that cause 3e-2 to be 0.03000000... 1? |
13:56:32 | FromGitter | <kaushalmodi> Maybe the code Araq shared above helps solve that? |
14:01:27 | PMunch | I guess 3e |
14:01:39 | PMunch | I guess 3e-2 should actually be 0.0299999999999999988897769753748434595763683319091796875 |
14:01:58 | PMunch | And not 0.030[...]01 |
14:02:09 | * | endragor quit (Remote host closed the connection) |
14:02:32 | Araq | Sheldon Cooper's fun with floating points |
14:06:38 | leorize | Araq: is it possible to skip certain patterns in `{.compile: '*.c'.}` statements? |
14:06:55 | leorize | I'm updating the `ui` library to use the upstream libui directly |
14:07:18 | leorize | but the source tree of libui have a bunch of `OLD_*.c` file that shouldn't be compiled |
14:08:31 | * | revere quit (Ping timeout: 250 seconds) |
14:10:37 | poopBot | hmm, if i have ambigous call, how to specifie from what to run, atm am trying to laod img , it accepts resourse path or file path , if i pass just Image("somepath") it crys i tryed Image(filepath:"somepath") and some other vartions but dident figure out |
14:11:08 | leorize | `<module>.<procname>` |
14:11:56 | Araq | leorize, no it's not possible |
14:12:30 | leorize | so I'm better off having `walkDir` clean up those file then? |
14:12:43 | Araq | yup |
14:12:45 | leorize | actually I don't know if walkDir work in NimScript... |
14:12:56 | dom96_w | leorize: you can get nimble to skip the installation of those files |
14:13:30 | dom96_w | problem with that is you won't be able to test the package without installing it though |
14:13:46 | * | PrimHelios_ joined #nim |
14:13:57 | leorize | well, that might be a problem... |
14:14:22 | poopBot | PMunch, you here? want to add Image but it crys ambigous call |
14:14:45 | shashlick | dom96_w: https://github.com/dom96/choosenim/pull/97 tests passed, can you please merge |
14:17:25 | poopBot | Image(newImage(filename="/home/me/Downloads/121361-7-3.jpg")) |
14:17:30 | poopBot | this too dosent work |
14:19:10 | narimiran | btw, speaking of choosenim, now `koch` and `nimsuggest` are not created in ~/.nimble/bin, should those be added? |
14:19:26 | narimiran | sorry, not `nimsuggest` but `nimpretty` |
14:19:56 | PMunch | poopBot, sorry. I was in the bathroom. But yeah, specify which module the procedure comes from |
14:20:55 | poopBot | can i get a spoon cuz i think i tryed evrything allready |
14:24:43 | narimiran | now i see `nimpretty` was already added, but we can't use it until choosenim's version is updated |
14:25:11 | poopBot | PMunch, https://hastebin.com/woxezulaju.cs |
14:25:15 | * | revere joined #nim |
14:26:58 | PMunch | poopBot, well there is a slight problem |
14:27:21 | poopBot | is that good or bad :) |
14:28:00 | PMunch | Ah |
14:28:08 | * | revere quit (Client Quit) |
14:28:44 | * | revere joined #nim |
14:29:11 | PMunch | Wait, this doesn't work? newImage(filename = "/home/me/Downloads/121361-7-3.jpg") |
14:29:52 | poopBot | Image(newImage(filename="/home/me/Downloads/121361-7-3.jpg")) |
14:30:02 | PMunch | Why do you have that outer Image? |
14:30:35 | FromGitter | <kaushalmodi> PMunch: I couldn't help but notice the strings "poopBot" and "bathroom" in the same message :P |
14:30:35 | poopBot | Cuz Button Box and Overlay Window all start like that in higharcy tree |
14:30:52 | PMunch | Oh right, within genui |
14:30:59 | poopBot | yep |
14:31:34 | poopBot | anyway i plan to store images in sqlite, so will need to read from variable or something |
14:31:47 | PMunch | Hold on |
14:32:47 | poopBot | duno how will pxbuff be translated to nim, wile pulling blob from sqlite but guess will find out later on, anyway back to atm issue :) , status:holing on |
14:32:53 | poopBot | *holding |
14:36:09 | PMunch | poopBot, this works: http://ix.io/1pVu/ |
14:37:19 | poopBot | hmm i think i try like that allreyd |
14:37:23 | poopBot | will try again |
14:37:37 | PMunch | Basically Image get's converted to newImage, so the error that newImage was ambiguous basically meant that it couldn't find the right newImage to call. By specifying that we wanted the one that takes a filename it is able to grab the right one |
14:38:39 | poopBot | yep, it works, ye i got what was the issue just i was like 99% sure i tryed this allreadyand it ident cooperate |
14:38:54 | PMunch | Maybe you tried with : instead of = |
14:39:02 | poopBot | possible |
14:40:24 | PMunch | Oh well, I've got to run. Hopefully you won't run into too much trouble while I'm gone. And remember, if you ever want to see the output of the macro just run it with -d:debug |
14:40:30 | * | PMunch quit (Quit: Leaving) |
14:40:44 | poopBot | ok ty, i hope too :) |
14:56:54 | livcd | If I would know I cant safely work with templates in powershell I would start this project in wNim :-( |
14:57:30 | * | sagax_ quit (Remote host closed the connection) |
14:57:43 | Araq | you cannot use templates in powershell, powershell has no templates. Feel free to start in Nim. |
14:59:25 | FromGitter | <iffy> Does the example listed here work for you? https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importobjc-pragma |
14:59:52 | FromGitter | <iffy> I'm on macOS and am getting `error: cannot find interface declaration for 'Object', superclass of 'Greeter'`. Maybe I don't have libobjc? |
15:00:09 | * | sz0_ quit () |
15:00:25 | * | PrimHelios__ joined #nim |
15:00:45 | * | seni quit (Remote host closed the connection) |
15:01:00 | * | sz0 joined #nim |
15:02:44 | FromGitter | <iffy> I can get it to work if I make this change: https://gist.github.com/iffy/1cd472da9b2135ccc2a1cc1da3f83bbc |
15:03:04 | * | PrimHelios_ quit (Ping timeout: 264 seconds) |
15:03:44 | * | sz0 quit (Client Quit) |
15:04:20 | * | sz0 joined #nim |
15:04:55 | * | Vladar joined #nim |
15:06:16 | Araq | iffy: that's good enough |
15:07:40 | FromGitter | <mratsim> @AchalaSB use ewasm and convert C to web assembly, converting JS to webassembly will be less efficient. |
15:07:48 | livcd | Araq: i meant wpf's style and control templates |
15:08:00 | FromGitter | <mratsim> sorry not ewasm, emscripten |
15:09:04 | * | Trustable joined #nim |
15:10:22 | FromGitter | <iffy> Araq: here's the example I promised of `{.compile: "something.m" .}` not working for me: https://gist.github.com/iffy/7965d17fb688b4471abb7c350d61708c |
15:10:26 | FromGitter | <iffy> Should I file an issue? |
15:11:14 | FromGitter | <mratsim> Obj-C is still one of the official target until Apple phases it out completely for Swift I guess, so go for it ;) |
15:14:21 | * | PrimHelios__ quit (Quit: Leaving) |
15:16:39 | FromGitter | <arnetheduck> hey @Araq, would you consider a patch to remove the strong spaces syntax? |
15:20:05 | FromGitter | <mratsim> is that the command syntax? |
15:20:17 | poopBot | hmm, did db_sqlite or probbaly all db_ got update, now it asks for some chanel[TMsg] |
15:20:20 | FromGitter | <mratsim> like `echo foo(), bar()`? |
15:20:33 | dom96_w | That feature should be long gone by now. I'm hoping Araq won't have a problem with removing it. |
15:21:36 | poopBot | what i need to pass as chanel[TMsg] ? |
15:21:54 | dom96_w | mratsim: it's not, it's `5 + 5 * 2` being the same as `(5+5) * 2` IIRC |
15:22:09 | poopBot | oh an itn |
15:22:33 | FromGitter | <mratsim> for operators it respects precedence |
15:22:44 | leorize | arnetheduck: some bindings Araq wrote extensively use the command call syntax, so I doubt he'd accept it :P |
15:22:47 | FromGitter | <mratsim> don’t you mean 5 + 5 vs 5 +5 |
15:23:03 | poopBot | or not |
15:23:48 | dom96_w | ugh, the spacing got lost through the relay |
15:24:11 | dom96_w | or possibly even through my IRC client |
15:24:48 | FromGitter | <arnetheduck> this: https://github.com/nim-lang/Nim/commit/f23b7e37243036724053b3f6d475c4ac9f577661 |
15:24:52 | dom96_w | but yes, that's what I meant |
15:25:09 | FromGitter | <arnetheduck> ie it got removed from the docs 2 years ago, but it's still part of the code |
15:25:32 | FromGitter | <arnetheduck> dom96_w is on the spot |
15:25:42 | dom96_w | Create the PR. I'm happy to accept it (and fight Araq if necessary) |
15:26:17 | FromGitter | <arnetheduck> it's enough work that I'd prefer the fight to happen before the code is written |
15:26:25 | leorize | oh, that strong spaces |
15:28:40 | poopBot | can somone tell me whats this chanel[TMsg] error msg, like 5 days ago sqlite worked i think no problem now it asks for this chnael[TMsg] , from what i read it has something to do with threads but it wont alowe me to create a variable var cn : Channel so i can pass it, i tryed turning on off --threads to to check if that was a issue |
15:29:45 | leorize | `db_` family of modules doesn't require Channel... |
15:31:08 | poopBot | https://hastebin.com/tijohuyalo.cs |
15:31:29 | poopBot | i think i tested db_sqlite like a week ago and all worked np |
15:31:51 | leorize | poopBot: nil string doesn't exist anymore... |
15:31:55 | leorize | use empty strings instead |
15:32:18 | leorize | and yea, the docs of db_* should be updated |
15:32:27 | * | rockcavera joined #nim |
15:34:04 | * | nsf quit (Quit: WeeChat 2.2) |
15:34:04 | poopBot | hmm,ok now it works, tought i duno why it cryaed for Channel[open.TMsg] insted "Cant use nil no more" |
15:34:24 | poopBot | how to update docs |
15:34:46 | Araq | arnetheduck: yeah but I can do it too, I keep removing old cruft |
15:35:18 | leorize | poopBot: if you skim through the list you'd see why... |
15:35:26 | Araq | this feature cannot work with macros.parseExpr anyway |
15:36:09 | FromGitter | <arnetheduck> oh, that'd be great. started thinking about a code formatter, and getting that cruft out of the way would help a lot. |
15:37:26 | FromGitter | <arnetheduck> @Araq in the grammar btw (https://nim-lang.org/docs/manual.html#syntax-grammar), `optInd` is specced as a comment only, but in reality it also eats indent |
15:38:18 | Araq | I don't really want to bring this up, but I have a much better way of how to do indentation based parsing that is 99% compatible with the existing Nim... |
15:39:00 | Araq | so yeah, optInd etc is kinda messed up |
15:39:26 | poopBot | leorize, it tryed to apply all posible overolads on proc and shooted error for each |
15:39:41 | leorize | yep, quite helpful, really :) |
15:40:17 | FromGitter | <arnetheduck> speaking of cruft, I think it's a bit of a problem having nimpretty behind `-d` switches as it is.. it makes both the pretty code and the compiler code more complex.. specially the way the comment handling is done, it's really quite hard to follow what's going on.. |
15:40:53 | FromGitter | <arnetheduck> but anyway. getting the strong spaces stuff out of there would be a great first step. |
15:41:34 | Araq | clang uses 2 different parsers instead, I think |
15:41:42 | Araq | one for formatting, one for compiling |
15:41:53 | Araq | I like my solution better for now |
15:41:54 | FromGitter | <arnetheduck> yeah it does. |
15:42:16 | FromGitter | <arnetheduck> same lexer afair, but separate parsers |
15:43:30 | FromGitter | <arnetheduck> the formatter is more tolerant of small mistakes.. that's actually a fantastic feature once you get used to it.. you just type some code "approximately" and the formatter takes care of cleaning it up for you so you can fix the small details with nice formatting already |
15:44:17 | FromGitter | <alehander42> actually the strong spaces precedence thing was cute(I think I saw it in 1 other language too), but it can't survive in the existing lang ecosystem |
15:45:14 | narimiran | wow, i didn't know that "colon is proc" https://github.com/nim-lang/Nim/blob/devel/tests/misc/tcolonisproc.nim |
15:45:34 | narimiran | btw, why is that in false block, it seems to be working just fine |
15:46:24 | Araq | narimiran, don't go there. |
15:46:52 | narimiran | haha, ok |
15:47:25 | * | floppydh quit (Quit: WeeChat 2.2) |
15:47:39 | FromGitter | <mratsim> you can use the do syntax for that |
15:48:04 | dom96_w | You can use the -> macro for that |
15:48:30 | dom96_w | The do notation and whatever that colonisproc thing is should die. |
15:49:04 | poopBot | is there some fileReadAsBanary("Path") in os or am i blind? |
15:49:29 | dom96_w | no, you read it as a string and treat the data as a binary |
15:49:34 | dom96_w | There is no special binary file reader |
15:49:55 | poopBot | ok will try |
15:50:04 | narimiran | @mratsim i usually see `do` used together with `quote`, but not for other stuff. i guess `->` might be nicer |
15:50:29 | FromGitter | <mratsim> do replace argument from the last one |
15:51:01 | FromGitter | <arnetheduck> @alehander42 I don't have any issues or opinions on the strong spaces feature itself - my beef with it, and a lot of the nim compiler compiler code, is that there are plenty of half-finished features and cruft in there, making it unnecessarily hard to contribute improvements without breaking something |
15:51:02 | FromGitter | <mratsim> `proc foo(a, b: int)` can be called with foo(a) do: 1 + 1 |
15:51:31 | FromGitter | <alehander42> @dom96_w there is a lot of existing `do (..)` code |
15:51:44 | FromGitter | <alehander42> and what is the `->` macro? the one in sugar is only for type signature |
15:51:44 | dom96_w | I'm aware |
15:51:50 | dom96_w | I mean the => macro |
15:52:34 | dom96_w | This won't stop me from advocating for the removal of the do notation. I have been meaning to create an official proposal for that for years now. |
15:53:51 | FromGitter | <alehander42> @dom96_w why do you hate it so much? I agree that removing it can simplify the language a bit |
15:53:55 | FromGitter | <mratsim> I think your last commit broke distinctBase in sugar @Araq, I’m trying to add some OpenMP stuff and I get: ⏎ ⏎ ../../laser/tensor/datatypes.nim(111, 15) template/generic instantiation of `distinctBase` from here ⏎ ../../../Nim/lib/pure/sugar.nim(209, 21) Error: undeclared identifier: ‘uncheckedArray' [https://gitter.im/nim-lang/Nim?at=5bd09593bbdc0b2505925f5f] |
15:53:55 | dom96_w | mratsim: Huh? You're missing a proc type in there, right? |
15:54:16 | FromGitter | <mratsim> no? |
15:54:20 | FromGitter | <alehander42> but we need to provide a tool that tries to rewrite do usages with e.g. `=>` at least semiautomatically |
15:54:26 | dom96_w | alehander42: It doesn't fit the language, using it is awkward and not consistent with the proc def syntax |
15:55:03 | FromGitter | <mratsim> for some reason uncheckedArray has the first letter in lowercase |
15:55:10 | dom96_w | sure, that can be done. |
15:58:12 | * | darithorn joined #nim |
16:01:45 | narimiran | another test file.... what's the point of this test exactly? https://github.com/nim-lang/Nim/blob/devel/tests/misc/thintoff.nim |
16:04:30 | FromGitter | <arnetheduck> there's one more similar feature to `do`: the last-argument-is-the-body feature of templates.. neither of these feel very natural coming from other languages, though I've never used either extensively |
16:04:38 | poopBot | dumb question but how to treat string as binary, do i need to parse it or what? |
16:04:50 | poopBot | cast? |
16:07:42 | dom96_w | arnetheduck: huh, no other language has this? How do macros/templates in other languages consume code? |
16:08:20 | FromGitter | <alehander42> @arnetheduck in ruby blocks are consumed with a special `&arg`, is that what you would expect |
16:09:31 | * | NimBot joined #nim |
16:13:35 | poopBot | can somone tell me how to use string as binary, pls :) |
16:14:34 | poopBot | i read my file var imgBinary : string = readFile("/home/me/Downloads/121361-7-3.jpg") |
16:14:40 | FromGitter | <arnetheduck> it's more when producing the block than when consuming them that is a bit unusual.. ie the syntax for expanding a template is not the same as for declaring it.. in the declaration, the arg is inside the parens, while in invocation, it's outside |
16:15:08 | poopBot | but when i try to insert it in sqlite as a blob i get Error: unhandled exception: unrecognized token: "'����" [DbError] |
16:15:32 | FromGitter | <alehander42> @arnetheduck well, you wouldn't expect ``` ⏎ proc (l: T) `+` (r: T): ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5bd09aa4ae7be94016ac47d2] |
16:17:17 | poopBot | my guess is i need it to be as seq[bytes] or something |
16:18:19 | FromGitter | <arnetheduck> so `template(a, x: untyped) = ..` is called like `x(3): blabla`.. the declaration doesn't show that the latter "works", you have to go read the manual.. in a non-whitespace-delimited lang, it would be natural that the `x` template gets 2 args where the second isdelimited with `{}` or some sugar variant of that.. ie `x(3, { blabla })` would be the way to pass code into the template |
16:19:14 | poopBot | hope toBin works |
16:19:49 | * | crem quit (Ping timeout: 250 seconds) |
16:21:34 | FromGitter | <arnetheduck> the `do` syntax does similar magic with the last argument.. declaring and calling is different, and feels a bit arbitrary - but again, this may simply be because I'm unfamiliar with the feature.. take haskell currying for example, there's a strong theoretical reason for why it works - in fact, it underpins the whole function call syntax there making it feel consistent with the rest of the language.. I'm not sure if |
16:21:34 | FromGitter | ... that's the case with `do`? |
16:21:39 | FromGitter | <alehander42> @arnetheduck the example with + was intended to show that usually you have a lot of syntaxes (not only `: block`) which are sugar for function calls: and making the signature of each function similar to the invocation syntax would only complicate the language ⏎ ⏎ e.g. `{}` for templates ⏎ ⏎ `proc a: T[b: U]` ... [https://gitter.im/nim-lang/Nim?at=5bd09c1382893a2f3b32c4aa] |
16:21:54 | * | crem joined #nim |
16:22:23 | FromGitter | <alehander42> all of those seem equally reasonable to me (as they now follow their invocation syntax) |
16:26:18 | narimiran | " Warning: the '.this' pragma is deprecated " -> what should be used instead? |
16:27:09 | FromGitter | <mratsim> @arnetheduck I agree that the do is a bit bothering, this is an example of unreadable do notation that I’m currently cleaning: https://github.com/mratsim/Arraymancer/blob/3d1377214453198382b3f7e8d896b379ba02f00e/src/tensor/aggregate.nim#L89-L103 |
16:27:11 | FromGitter | <arnetheduck> yeah, that's an interesting point.. not sure what a good approach for that is, but every "new" way is something that you have to teach users of the lang |
16:29:11 | FromGitter | <arnetheduck> the way I like to learn a lang is to build a minimal mental model of the language from which I can derive the rest - ie first principles of the syntax - haven't been able to fit "do" into that model just yet |
16:29:38 | FromGitter | <mratsim> the do is a bulldozer in a homely landscape :P |
16:31:02 | poopBot | string as binary, how, pls :) |
16:31:41 | FromGitter | <kaushalmodi> poopBot: what does that mean? How would you expect to see "abc" in binary? |
16:32:10 | FromGitter | <mratsim> cast\seq\[byte\ (yourString) but don’t do this at thome :P |
16:32:51 | poopBot | 01100001 01100010 01100011 |
16:33:17 | poopBot | i can write it like that "cast\seq\[byte\ (yourString)" wierdest sytax ye |
16:34:09 | poopBot | or not, i asked 20 rows up do i need to cast it tought duno how to do that in nim |
16:34:18 | FromGitter | <kaushalmodi> poopBot: what is the type of that 0/1 stream? `seq[byte]`? |
16:34:42 | poopBot | yes |
16:34:47 | poopBot | i think :) |
16:35:22 | poopBot | i think i found page on Nim and casting |
16:37:49 | FromGitter | <kaushalmodi> poopBot: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd09fddbbdc0b250592a80f] |
16:41:28 | poopBot | hmm thats creating a new variable cant i just cast it like dom96 sead, "treat string as binary" |
16:44:10 | FromGitter | <kaushalmodi> hmm, that's out of my knowledge area then. I simply avoided casting based on the warnings I've read in the manual |
16:45:00 | poopBot | hmm guess i can do that too, anyway ty for help |
16:47:30 | dom96_w | You shouldn't need to cast anything |
16:47:41 | poopBot | how so? |
16:47:45 | dom96_w | You're trying to get this binary data into sqlite right? |
16:47:48 | dom96_w | That's your end goal? |
16:47:50 | poopBot | yep |
16:48:15 | poopBot | and leater on to read it to img in gtk, but 1 step at a time xD |
16:48:24 | poopBot | var imgString : string = readFile("/home/me/Downloads/121361-7-3.jpg") |
16:48:31 | poopBot | is what i am using atm |
16:49:53 | dom96_w | what data type are you using in SQLite? |
16:49:59 | poopBot | BLOB |
16:50:32 | dom96_w | hrm, then perhaps Nim's db_sqlite has a bug when it comes to binary data |
16:50:57 | poopBot | :) |
16:51:08 | poopBot | can write you what error i get |
16:51:36 | dom96_w | what's your code that is inserting this image into the db? |
16:51:53 | poopBot | db.exec(sql"INSERT INTO myTable (slika) VALUES (?)", imgBinary) |
16:52:53 | poopBot | db_sqlite.nim(104) dbError |
16:52:53 | poopBot | Error: unhandled exception: unrecognized token: "'����" [DbError] |
16:53:46 | dom96_w | Yeah, I don't think you can use an ordinary insert like that to put binary data into the db |
16:53:50 | dom96_w | https://stackoverflow.com/questions/8884058/sqlite-is-it-possible-to-insert-a-blob-via-insert-statement |
16:54:08 | leorize | You can if you use https://github.com/xzfc/ndb.nim |
16:54:25 | dom96_w | Like suggested in that SO post you can encode it as hex |
16:55:04 | dom96_w | oh, that's nice. We should pull that into stdlib if possible |
16:58:05 | poopBot | i will try that ndb |
16:58:13 | FromGitter | <mratsim> otherwise for dealing with blobs here is a super simple lib: https://github.com/status-im/nim-byteutils/blob/master/byteutils.nim |
16:59:18 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:04:46 | FromDiscord | <Shield> what's the best way to expose the host's functions to a shared library (both are made with nim)? |
17:16:51 | * | nsf joined #nim |
17:17:12 | FromGitter | <alehander42> @mratsim well, if you use `=>` the code looks even worse |
17:17:28 | FromGitter | <alehander42> I am not really sure what's the best replacement for `do` |
17:19:15 | FromGitter | <alehander42> I actually think the whole issue is |
17:19:22 | FromGitter | <alehander42> that we use `: ReturnType =` |
17:19:30 | FromGitter | <alehander42> if this was `-> ReturnType:` |
17:19:50 | FromGitter | <alehander42> this would be more intuitive, as every other block in nim is after `:` |
17:20:03 | FromGitter | <alehander42> and it would be compatible with the do syntax |
17:20:28 | FromGitter | <mratsim> I think the ship has sailed |
17:20:32 | FromGitter | <alehander42> absolutely |
17:20:45 | FromGitter | <alehander42> but I am trying to say that `do`'s design is actually fine |
17:20:53 | FromGitter | <alehander42> for me |
17:21:30 | FromGitter | <mratsim> well it’s weird and impossible to find it intuitively but it works for me as well |
17:21:49 | FromGitter | <alehander42> well, if `proc` had intuitive design |
17:22:00 | FromGitter | <alehander42> `do` would be almost obvious |
17:22:51 | FromGitter | <alehander42> maybe you could even define it as a macro(if we had infix operator macros): stuff `do` signature:block converging to call |
17:24:58 | FromGitter | <mratsim> let’s get nimpretty working first ;) |
17:27:45 | * | Trustable quit (Remote host closed the connection) |
17:30:16 | FromGitter | <alehander42> nah, that's alternate reality stuff (the do / different proc thing) |
17:31:04 | FromGitter | <alehander42> now i am kinda sad they didn't have lisp machines in e.g. `the man in the high castle` |
17:33:03 | FromGitter | <mratsim> btw, do you have a way to get all the expression “leafs” of the AST? ⏎ ⏎ For loopfusion, it would be useful to supports conditionals and replace ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd0accf271506518d63caca] |
17:38:28 | FromGitter | <alehander42> well, it seems very NimNodeKind specific |
17:39:51 | FromGitter | <mratsim> I guess a isFreeStandingExpression macro/magic would be useful |
17:42:10 | FromGitter | <alehander42> it seems simple to write, just a bit tedious (you have to blacklist cases like foo and bar for each kind) |
17:42:58 | FromGitter | <mratsim> not sure, assume there is a: ⏎ `let baz = x + 2` ⏎ somewhere, you need to stop because x + 2 is an expression but it’s assign |
17:43:11 | FromGitter | <mratsim> same thing when it’s inside a call |
17:43:25 | FromGitter | <mratsim> but a call can return a free standing expression |
17:46:09 | FromGitter | <alehander42> well, I expect that one provides some kind of context: e.g. root node in which the question is `is this node free standing in root?` |
17:48:51 | * | Arrrr joined #nim |
18:08:12 | * | PrimHelios_ joined #nim |
18:08:47 | * | stefanos82 quit (Quit: Quitting for now...) |
18:12:33 | * | krux02 quit (Remote host closed the connection) |
18:21:52 | FromGitter | <yyyc514> Error: module names need to be unique per Nimble package; |
18:21:56 | FromGitter | <yyyc514> well i kind of get that, but grrrr |
18:22:08 | FromGitter | <yyyc514> i used folders to categorize things :) |
18:23:10 | leorize | put all of them in a `<proj>` subfolder |
18:23:15 | leorize | then nimble will be happy |
18:23:51 | * | Vladar quit (Remote host closed the connection) |
18:25:15 | * | PrimHelios_ quit (Ping timeout: 264 seconds) |
18:26:45 | FromGitter | <yyyc514> they are already in different folders |
18:26:50 | FromGitter | <yyyc514> it didn’t liek that i had dup module names |
18:26:57 | FromGitter | <yyyc514> views/pastes controllers/pastes |
18:27:34 | FromGitter | <yyyc514> actually seems like someone would hit this |
18:27:48 | FromGitter | <yyyc514> does it divide them based on the project root folder? |
18:27:56 | FromGitter | <yyyc514> ie, anything outside that is in another naming scope? |
18:28:18 | FromGitter | <yyyc514> i mean i kind of see how you couldn’t refernce them both in the same file though i guess :) |
18:28:28 | FromGitter | <yyyc514> except you don’t really reference by the scope that often |
18:29:05 | leorize | what's your current project tree? |
18:29:17 | leorize | I just tried with a dummy project and `nimble check` didn't complain |
18:36:58 | FromGitter | <alehander42> nah the problem is when you compile and you get two of them I think |
18:37:55 | FromGitter | <alehander42> https://forum.nim-lang.org/t/2937 |
18:49:06 | * | NimBot joined #nim |
18:49:16 | * | crem quit (*.net *.split) |
18:49:16 | * | chemist69 quit (*.net *.split) |
18:49:16 | * | regtools quit (*.net *.split) |
18:49:16 | * | flyx quit (*.net *.split) |
18:49:16 | * | nif quit (*.net *.split) |
18:49:16 | * | def- quit (*.net *.split) |
18:49:17 | * | MrAxilus[m] quit (*.net *.split) |
18:49:17 | * | revere quit (*.net *.split) |
18:49:17 | * | leorize quit (*.net *.split) |
18:49:17 | * | xet7 quit (*.net *.split) |
18:49:17 | * | PrimHelios quit (*.net *.split) |
18:49:17 | * | Jesin quit (*.net *.split) |
18:49:17 | * | voiceftp quit (*.net *.split) |
18:49:17 | * | gangstacat quit (*.net *.split) |
18:49:17 | * | gmpreussner quit (*.net *.split) |
18:49:17 | * | mech422__ quit (*.net *.split) |
18:49:17 | * | banc quit (*.net *.split) |
18:49:17 | * | couven92 quit (*.net *.split) |
18:49:17 | * | mr_yogurt quit (*.net *.split) |
18:49:17 | * | mal``` quit (*.net *.split) |
18:49:17 | * | beatmox quit (*.net *.split) |
18:49:17 | * | fyber quit (*.net *.split) |
18:49:17 | * | Cthalupa quit (*.net *.split) |
18:49:17 | * | cavariux quit (*.net *.split) |
18:49:17 | * | joshbaptiste quit (*.net *.split) |
18:49:17 | * | pwntus quit (*.net *.split) |
18:49:17 | * | Sargun quit (*.net *.split) |
18:49:17 | * | masterm quit (*.net *.split) |
18:49:17 | * | acidx quit (*.net *.split) |
18:49:17 | * | nuxdie quit (*.net *.split) |
18:49:18 | * | noonien quit (*.net *.split) |
18:49:18 | * | zacharycarter[m] quit (*.net *.split) |
18:49:18 | * | kadin quit (*.net *.split) |
18:49:18 | * | zama quit (*.net *.split) |
18:49:18 | * | tobbez quit (*.net *.split) |
18:49:18 | * | dom96 quit (*.net *.split) |
18:49:18 | * | Amun_Ra quit (*.net *.split) |
18:49:18 | * | qwertfisch quit (*.net *.split) |
18:49:18 | * | hwallann quit (*.net *.split) |
18:49:18 | * | opi_ quit (*.net *.split) |
18:49:18 | * | xomachine[m] quit (*.net *.split) |
18:49:18 | * | EastByte quit (*.net *.split) |
18:49:18 | * | vqrs quit (*.net *.split) |
18:49:19 | * | m712 quit (*.net *.split) |
18:49:19 | * | msmorgan_ quit (*.net *.split) |
18:49:19 | * | hogeland quit (*.net *.split) |
18:49:19 | * | kapil____ quit (*.net *.split) |
18:49:19 | * | bozaloshtsh quit (*.net *.split) |
18:49:19 | * | Yardanico quit (*.net *.split) |
18:49:19 | * | TheKing[m] quit (*.net *.split) |
18:49:19 | * | planetis[m] quit (*.net *.split) |
18:49:19 | * | syntonym[m]1 quit (*.net *.split) |
18:49:19 | * | pigmej quit (*.net *.split) |
18:49:19 | * | Connor[m]1 quit (*.net *.split) |
18:49:19 | * | hohlerde quit (*.net *.split) |
18:49:19 | * | shashlick quit (*.net *.split) |
18:49:19 | * | derlafff quit (*.net *.split) |
18:49:19 | * | sg-james[m] quit (*.net *.split) |
18:49:19 | * | JStoker quit (*.net *.split) |
18:49:19 | * | enigmeta quit (*.net *.split) |
18:49:19 | * | LyndsySimon quit (*.net *.split) |
18:49:19 | * | sz0 quit (*.net *.split) |
18:49:19 | * | surma__ quit (*.net *.split) |
18:49:19 | * | euantor quit (*.net *.split) |
18:49:19 | * | vegax87 quit (*.net *.split) |
18:49:19 | * | lukd quit (*.net *.split) |
18:49:19 | * | r4vi quit (*.net *.split) |
18:49:19 | * | zielmicha__ quit (*.net *.split) |
18:49:20 | * | shodan45 quit (*.net *.split) |
18:49:20 | * | gh0st[m]1 quit (*.net *.split) |
18:49:20 | * | Demos[m] quit (*.net *.split) |
18:49:20 | * | dada78641 quit (*.net *.split) |
18:49:20 | * | monofuel[m] quit (*.net *.split) |
18:49:20 | * | sendell[m] quit (*.net *.split) |
18:49:21 | * | SolitudeSF[m] quit (*.net *.split) |
18:49:21 | * | spymasterd[m] quit (*.net *.split) |
18:49:21 | * | jaens[m] quit (*.net *.split) |
18:49:21 | * | narimiran[m] quit (*.net *.split) |
18:49:21 | * | codevance[m] quit (*.net *.split) |
18:49:21 | * | jakeprem quit (*.net *.split) |
18:49:21 | * | deepend quit (*.net *.split) |
18:49:21 | * | bitstoppa[m] quit (*.net *.split) |
18:49:21 | * | FromGitter quit (*.net *.split) |
18:49:21 | * | AlexMax quit (*.net *.split) |
18:49:21 | * | xylef quit (*.net *.split) |
18:49:21 | * | petersjt014[m] quit (*.net *.split) |
18:49:21 | * | dyce[m] quit (*.net *.split) |
18:49:21 | * | Elronnd quit (*.net *.split) |
18:49:21 | * | junland quit (*.net *.split) |
18:49:21 | * | notbot[m] quit (*.net *.split) |
18:49:21 | * | Xe quit (*.net *.split) |
18:49:21 | * | snowolf quit (*.net *.split) |
18:49:21 | * | awal quit (*.net *.split) |
18:49:22 | * | macsek1911[m] quit (*.net *.split) |
18:49:22 | * | dashed quit (*.net *.split) |
18:49:22 | * | odc quit (*.net *.split) |
18:49:22 | * | SunDwarf quit (*.net *.split) |
18:49:22 | * | endes[m] quit (*.net *.split) |
18:49:22 | * | stisa[m] quit (*.net *.split) |
18:49:22 | * | dvn quit (*.net *.split) |
18:49:22 | * | cornfeedhobo quit (*.net *.split) |
18:49:22 | * | Miguelngel[m] quit (*.net *.split) |
18:49:22 | * | k0mpjut0r quit (*.net *.split) |
18:49:22 | * | toofly[m] quit (*.net *.split) |
18:49:22 | * | zielmicha[m] quit (*.net *.split) |
18:49:22 | * | TheManiac[m] quit (*.net *.split) |
18:49:22 | * | yglukhov[m] quit (*.net *.split) |
18:49:22 | * | pqflx3[m] quit (*.net *.split) |
18:49:22 | * | GitterIntegratio quit (*.net *.split) |
18:49:22 | * | pydsigner quit (*.net *.split) |
18:49:22 | * | rockcavera quit (*.net *.split) |
18:49:22 | * | narimiran quit (*.net *.split) |
18:49:22 | * | edcragg quit (*.net *.split) |
18:49:22 | * | Tongir quit (*.net *.split) |
18:49:22 | * | rlr quit (*.net *.split) |
18:49:22 | * | spookydeath916 quit (*.net *.split) |
18:49:22 | * | Summertime quit (*.net *.split) |
18:49:22 | * | copygirl quit (*.net *.split) |
18:49:22 | * | FromDiscord quit (*.net *.split) |
18:49:22 | * | oky quit (*.net *.split) |
18:49:22 | * | gsingh93 quit (*.net *.split) |
18:49:22 | * | jxy quit (*.net *.split) |
18:49:22 | * | ng0 quit (*.net *.split) |
18:49:22 | * | abeaumont quit (*.net *.split) |
18:49:22 | * | c15ade4 quit (*.net *.split) |
18:49:22 | * | onionhammer quit (*.net *.split) |
18:49:23 | * | jonafato quit (*.net *.split) |
18:49:23 | * | CcxWrk quit (*.net *.split) |
18:49:23 | * | livcd quit (*.net *.split) |
18:49:23 | * | poopBot quit (*.net *.split) |
18:49:23 | * | flaviu quit (*.net *.split) |
18:49:23 | * | xace quit (*.net *.split) |
18:49:23 | * | ghost64 quit (*.net *.split) |
18:49:23 | * | masterdonx quit (*.net *.split) |
18:49:23 | * | avsej quit (*.net *.split) |
18:49:23 | * | Lord_Nightmare quit (*.net *.split) |
18:49:23 | * | oprypin quit (*.net *.split) |
18:49:23 | * | ltr_ quit (*.net *.split) |
18:49:23 | * | ldlework quit (*.net *.split) |
18:49:23 | * | GaveUp quit (*.net *.split) |
18:49:36 | * | Arrrr joined #nim |
18:54:15 | * | PrimHelios_ joined #nim |
18:54:44 | * | gmpreussner joined #nim |
18:54:44 | * | so joined #nim |
18:54:44 | * | tribly_ joined #nim |
18:54:44 | * | Calinou_ joined #nim |
18:54:44 | * | Araq_ joined #nim |
18:54:44 | * | cstaeth joined #nim |
18:54:44 | * | nsf1 joined #nim |
18:54:44 | * | d10n_ joined #nim |
18:54:44 | * | darithorn_ joined #nim |
18:54:44 | * | federico3_ joined #nim |
18:54:44 | * | craigger_ joined #nim |
18:54:44 | * | redlegion_ joined #nim |
18:54:44 | * | skelett1 joined #nim |
18:54:44 | * | smt` joined #nim |
18:54:44 | * | MyMind joined #nim |
18:54:44 | * | abm joined #nim |
18:54:44 | * | crem joined #nim |
18:54:44 | * | rockcavera joined #nim |
18:54:44 | * | sz0 joined #nim |
18:54:44 | * | revere joined #nim |
18:54:44 | * | narimiran joined #nim |
18:54:44 | * | leorize joined #nim |
18:54:44 | * | poopBot joined #nim |
18:54:44 | * | chemist69 joined #nim |
18:54:44 | * | xet7 joined #nim |
18:54:44 | * | mech422__ joined #nim |
18:54:44 | * | kapil____ joined #nim |
18:54:44 | * | bozaloshtsh joined #nim |
18:54:44 | * | banc joined #nim |
18:54:44 | * | PrimHelios joined #nim |
18:54:44 | * | Jesin joined #nim |
18:54:44 | * | voiceftp joined #nim |
18:54:44 | * | couven92 joined #nim |
18:54:44 | * | gangstacat joined #nim |
18:54:44 | * | deepend joined #nim |
18:54:44 | * | edcragg joined #nim |
18:54:44 | * | oky joined #nim |
18:54:44 | * | regtools joined #nim |
18:54:44 | * | Yardanico joined #nim |
18:54:44 | * | flaviu joined #nim |
18:54:44 | * | xace joined #nim |
18:54:44 | * | Tongir joined #nim |
18:54:44 | * | Summertime joined #nim |
18:54:44 | * | hwallann joined #nim |
18:54:44 | * | Cthalupa joined #nim |
18:54:44 | * | opi_ joined #nim |
18:54:44 | * | def- joined #nim |
18:54:44 | * | nif joined #nim |
18:54:44 | * | flyx joined #nim |
18:54:44 | * | gh0st[m]1 joined #nim |
18:54:44 | * | TheKing[m] joined #nim |
18:54:44 | * | planetis[m] joined #nim |
18:54:44 | * | syntonym[m]1 joined #nim |
18:54:44 | * | cavariux joined #nim |
18:54:44 | * | k0mpjut0r joined #nim |
18:54:44 | * | c15ade4 joined #nim |
18:54:44 | * | noonien joined #nim |
18:54:44 | * | pigmej joined #nim |
18:54:44 | * | rlr joined #nim |
18:54:44 | * | Connor[m]1 joined #nim |
18:54:44 | * | hohlerde joined #nim |
18:54:44 | * | xomachine[m] joined #nim |
18:54:44 | * | bitstoppa[m] joined #nim |
18:54:44 | * | zacharycarter[m] joined #nim |
18:54:44 | * | shashlick joined #nim |
18:54:44 | * | derlafff joined #nim |
18:54:44 | * | kadin joined #nim |
18:54:44 | * | sg-james[m] joined #nim |
18:54:44 | * | zama joined #nim |
18:54:44 | * | xylef joined #nim |
18:54:44 | * | EastByte joined #nim |
18:54:44 | * | spookydeath916 joined #nim |
18:54:44 | * | petersjt014[m] joined #nim |
18:54:44 | * | endes[m] joined #nim |
18:54:44 | * | onionhammer joined #nim |
18:54:44 | * | Demos[m] joined #nim |
18:54:44 | * | dyce[m] joined #nim |
18:54:44 | * | vqrs joined #nim |
18:54:44 | * | MrAxilus[m] joined #nim |
18:54:44 | * | stisa[m] joined #nim |
18:54:44 | * | mr_yogurt joined #nim |
18:54:44 | * | copygirl joined #nim |
18:54:44 | * | FromGitter joined #nim |
18:54:44 | * | tobbez joined #nim |
18:54:44 | * | JStoker joined #nim |
18:54:44 | * | dada78641 joined #nim |
18:54:44 | * | AlexMax joined #nim |
18:54:44 | * | beatmox joined #nim |
18:54:44 | * | mal``` joined #nim |
18:54:44 | * | fyber joined #nim |
18:54:44 | * | nuxdie joined #nim |
18:54:44 | * | acidx joined #nim |
18:54:44 | * | masterm joined #nim |
18:54:44 | * | Sargun joined #nim |
18:54:44 | * | pwntus joined #nim |
18:54:44 | * | joshbaptiste joined #nim |
18:54:44 | * | qwertfisch joined #nim |
18:54:44 | * | Amun_Ra joined #nim |
18:54:44 | * | dom96 joined #nim |
18:54:44 | * | hogeland joined #nim |
18:54:44 | * | msmorgan_ joined #nim |
18:54:44 | * | m712 joined #nim |
18:54:44 | * | enigmeta joined #nim |
18:54:44 | * | LyndsySimon joined #nim |
18:54:44 | * | shodan45 joined #nim |
18:54:44 | * | zielmicha__ joined #nim |
18:54:44 | * | r4vi joined #nim |
18:54:44 | * | lukd joined #nim |
18:54:44 | * | vegax87 joined #nim |
18:54:44 | * | euantor joined #nim |
18:54:44 | * | surma__ joined #nim |
18:54:44 | * | jakeprem joined #nim |
18:54:44 | * | codevance[m] joined #nim |
18:54:44 | * | narimiran[m] joined #nim |
18:54:44 | * | jaens[m] joined #nim |
18:54:44 | * | spymasterd[m] joined #nim |
18:54:44 | * | SolitudeSF[m] joined #nim |
18:54:44 | * | sendell[m] joined #nim |
18:54:44 | * | monofuel[m] joined #nim |
18:54:44 | * | SunDwarf joined #nim |
18:54:44 | * | odc joined #nim |
18:54:44 | * | dashed joined #nim |
18:54:44 | * | macsek1911[m] joined #nim |
18:54:44 | * | awal joined #nim |
18:54:44 | * | Xe joined #nim |
18:54:44 | * | notbot[m] joined #nim |
18:54:44 | * | snowolf joined #nim |
18:54:44 | * | junland joined #nim |
18:54:44 | * | Elronnd joined #nim |
18:54:44 | * | pydsigner joined #nim |
18:54:44 | * | pqflx3[m] joined #nim |
18:54:44 | * | yglukhov[m] joined #nim |
18:54:44 | * | GitterIntegratio joined #nim |
18:54:44 | * | TheManiac[m] joined #nim |
18:54:44 | * | toofly[m] joined #nim |
18:54:44 | * | zielmicha[m] joined #nim |
18:54:44 | * | Miguelngel[m] joined #nim |
18:54:44 | * | cornfeedhobo joined #nim |
18:54:44 | * | dvn joined #nim |
18:54:44 | * | ng0 joined #nim |
18:54:45 | * | abeaumont joined #nim |
18:54:45 | * | jxy joined #nim |
18:54:45 | * | gsingh93 joined #nim |
18:54:45 | * | FromDiscord joined #nim |
18:54:45 | * | livcd joined #nim |
18:54:45 | * | CcxWrk joined #nim |
18:54:45 | * | jonafato joined #nim |
18:54:45 | * | GaveUp joined #nim |
18:54:45 | * | ldlework joined #nim |
18:54:45 | * | ltr_ joined #nim |
18:54:45 | * | oprypin joined #nim |
18:54:45 | * | Lord_Nightmare joined #nim |
18:54:45 | * | avsej joined #nim |
18:54:45 | * | masterdonx joined #nim |
18:54:45 | * | ghost64 joined #nim |
18:55:38 | leorize | !eval echo NimVersion |
18:55:41 | NimBot | 0.18.0 |
18:59:00 | * | jjido joined #nim |
19:00:02 | abm | isn't version 0.19.0 already out? |
19:00:30 | FromGitter | <kayabaNerve> TheLemonMan It still crashes due to thread storage size, but prints an argument that allows a larger thread size, and if you use that, it doesn't crash. |
19:00:48 | FromGitter | <kayabaNerve> As I said in the GitHub issue though: ⏎ "That said, the Channel is unusable since it's a threadvar and it never should be a threadvar. That said, we can chalk that up to the user being the idiot, and not an issue with the compiler itself." |
19:03:47 | copygirl | How does one get the name of a typedesc for displaying in an error pragma? |
19:04:11 | leorize | `import typetraits` and you get `$` for typedesc |
19:04:40 | copygirl | Alright, thank you <3 |
19:05:24 | FromGitter | <kayabaNerve> The PR was checked by Araq who said use rawWrite. The currrent PR does use rawWrite. It passes the tests and solves the issue in question. |
19:20:50 | * | jjido quit (Ping timeout: 268 seconds) |
19:22:45 | * | nsf1 quit (Quit: WeeChat 2.2) |
19:24:04 | dom96 | NimBot just calls play.nim-lang.org |
19:26:04 | FromGitter | <kayabaNerve> dom96 Playground isn't updated to 0.19 though. |
19:27:12 | FromGitter | <kayabaNerve> It's not a (total) excuse to say it's not an issue because it uses Playground. It just shifts the blame from the bot to playground. :thinking: |
19:27:49 | * | jjido joined #nim |
19:28:06 | dom96 | ehh, yeah? |
19:28:10 | dom96 | I don't maintain the playground |
19:33:05 | FromGitter | <cooldome> ... Hi, Does anyone know how openarray is represented in vm. I am thinking of adding toOpenArray magic to vm. |
19:33:12 | FromGitter | <kayabaNerve> Yeah... I was thinking about that. |
19:38:23 | * | jjido quit (Ping timeout: 246 seconds) |
19:42:02 | FromGitter | <Araq> @cooldome in the VM seq, openarray and array are all NimNode with nkBracket |
19:42:51 | FromGitter | <Araq> toOpenArray should be reasonably easy to implement if we can live with a copy, otherwise we would need to patch the indexing with offsets somehow, very complex |
19:45:48 | FromGitter | <cooldome> thx |
19:49:17 | * | Arrrr quit (Quit: Arrrr) |
19:55:38 | copygirl | So after some procrastination, I think I've finally build a 2 element Either type: https://gist.github.com/copygirl/e8c779b6727e85155d1ac223c1433778 |
19:55:55 | copygirl | Can be expanded more but I'd like to write macros to do that for me.. What would be the best way to do that? |
19:56:22 | FromGitter | <mratsim> Not sure what you want to do in the end but maybe check that: https://github.com/vegansk/nimfp/blob/master/src/fp/either.nim |
19:56:43 | copygirl | That's only 2 elements. |
19:57:18 | copygirl | This is for a json schema library I'm writing where properties can be multiple different types. (string, int, object 1, object 2, ...) |
19:58:26 | FromGitter | <mratsim> you can use an object variant |
19:58:48 | FromGitter | <mratsim> Like this: https://github.com/mratsim/chirp8/blob/master/src/cpu.nim#L62-L89 |
19:59:06 | FromGitter | <mratsim> you can directly use the JsonKind enum from sin/parsejson as the base |
19:59:15 | FromGitter | <mratsim> from json* |
19:59:42 | * | PrimHelios_ quit (Ping timeout: 252 seconds) |
20:00:01 | copygirl | I assume that won't work if I have two object schemas a property can be? |
20:00:16 | FromGitter | <mratsim> you speak like yoda :P |
20:00:18 | copygirl | Say { "foo": 1 } or { "bar": "string" } |
20:01:22 | FromGitter | <mratsim> that would be nodeKindObject: nodeKindInt or nodeKindObject: nodeKindString |
20:01:28 | copygirl | In my case I'd define that property as `someproperty: FooObject or BarObject`. And the idea is that I'd access it through jsonobj.someproperty[FooObject] |
20:01:43 | copygirl | No, both are objects. |
20:02:01 | FromGitter | <mratsim> yes this is what I’m saying |
20:02:11 | copygirl | One object with a foo property and one object with a string property. |
20:02:26 | FromGitter | <mratsim> both are object and the node below is either a key,int or a key,string pair |
20:03:17 | copygirl | https://gist.github.com/copygirl/4f8c7d034d21879e21ce20235fcf03e0 |
20:04:15 | copygirl | Does this help, maybe? The above code produces types and eventually I want validation and json -> nim object conversion code. I didn't get to the more complicated objects that can have different types. |
20:05:16 | copygirl | But say a buffer can be defined as a `{ "start": int, "end": int }` or `{ "length": int }`. |
20:06:05 | copygirl | It would be defined in the jsonschema block as `BufferStartEnd or BufferLength` for example. And the type of the property itself in the created nim code would be `Either2[BufferStartEnd, BufferLength]`. |
20:06:49 | copygirl | But I want `Either3[T0,T1,T2]` etc as well, not just 2 elements. |
20:08:03 | FromGitter | <mratsim> I would use JObject{JArray\[(“start”, “int”), (“end”, int”)\]} for the first end JObject{“length”, “int”} for the second |
20:08:31 | FromGitter | <mratsim> basically if you involve generic in the mix you will have to know the types at compile-time |
20:09:00 | FromGitter | <mratsim> If you have a fixed schema, that works |
20:09:29 | FromGitter | <mratsim> if the schema is known only at runtime you have to use type erasure: either ref object or object variant/sum types. |
20:09:42 | FromGitter | <mratsim> ref object+ inheritance* |
20:09:56 | copygirl | I... I'm not sure if I don't follow or you don't understand what I want to do. Sorry. |
20:10:08 | FromGitter | <mratsim> we’re probably talking past each other :P |
20:10:12 | FromGitter | <mratsim> no problem |
20:10:59 | FromGitter | <mratsim> But yeah you can use macros to create new case branches. |
20:11:54 | copygirl | I'm just wondering if there's a more convenient way to possibly do this. |
20:12:48 | FromGitter | <mratsim> maybe that helps: https://github.com/status-im/nimbus/blob/master/nimbus/vm/interpreter_dispatch.nim#L179-L208 ⏎ ⏎ It parse an array that maps an enum to a proc ⏎ and create a case statement for each enum -> proc pair [https://gitter.im/nim-lang/Nim?at=5bd0d240c08b8b306768a7b1] |
20:13:25 | copygirl | .... I thiiink... maybe a `quote` plus replace/repeat selected nodes (where I replace, say, the character X with the actual relevant number. TX with T0 for example. |
20:14:59 | dom96 | copygirl: are you parsing JSON? |
20:15:03 | copygirl | I just want to avoid manually putting together all the nim nodes. |
20:15:33 | copygirl | Not parsing itself, just putting into a type-safe, known-at-compile-time format. |
20:15:33 | dom96 | Like do you want to parse JSON that could be: { "start": 123, "end": 456} or {"length": 123}? |
20:16:05 | copygirl | I don't just want to validate, but also put into a nim object. |
20:16:35 | dom96 | I assume you know of the `to` macro? https://nim-lang.org/docs/json.html#to.m%2CJsonNode%2Ctypedesc |
20:17:38 | copygirl | How does it handle optional fields, fields which can be multiple types, ..? |
20:18:27 | dom96 | For optional fields you just use Option[T] |
20:18:46 | dom96 | for fields which can be multiple types you should use JsonNode |
20:20:31 | copygirl | Can you provide custom parsing behavior? |
20:21:47 | * | narimiran quit (Ping timeout: 240 seconds) |
20:23:12 | dom96 | Not really. You just have to parse that JsonNode after running `to` |
20:25:26 | FromGitter | <Araq> and don't use Either, Nim uses exceptions |
20:26:08 | copygirl | Mhh then I don't know how useful it is to me..? Maybe I'm just biased because I already put work in. |
20:26:22 | copygirl | My Either is not for exceptions, it's for something that can be multiple types. |
20:27:16 | FromGitter | <Araq> in theory, yes. in practice it's just some boilerplate-full manually implemented exception handling system |
20:28:51 | copygirl | Maybe I should not call it `Either`. That's a stupid name to use for something that can be an error, anyway. `Result` from Rust is way more fitting. |
20:29:06 | copygirl | But no, that's not the goal. In fact the type is never meant to be written out. |
20:30:25 | copygirl | You'd just do something like `var foo = fromJson.requiredProperty.someField[string]` where someField can be a string or int or object with various defined fields. (Or another object with different required fields.) |
20:30:54 | copygirl | (different set of required fields*) |
20:32:41 | copygirl | But I believe you helped me find a solution to my original question. |
20:36:46 | dom96 | If you've got ideas on how to improve the json.to macro I'm always happy to hear them |
20:38:13 | copygirl | Well this is sort of to write a dual validator and converter that's aiming to be compatible with the subset of jsonschema features to parse GLTF files. |
20:41:37 | copygirl | I fell into the typical rabbit hole. Long time ago I wanted to make a "simple" game. Got to the point where I could render a cube and there was mouse inputs, simple event system. |
20:41:45 | copygirl | Though I'd want to load model files. |
20:42:33 | copygirl | So current I'm 3 layers deep: game -> gltf library -> custom json schema parser -> either types. |
20:43:58 | copygirl | Oh one thing that my parser does that `to` can't is verifying that an optional field requires another to be valid. |
20:44:08 | copygirl | So `scene` is dependant on `scenes`. |
20:44:10 | Demos[m] | hm so I have: https://gist.github.com/barcharcraz/9ec04ca3a3a0f6f20df44659878d3ad5 |
20:44:11 | Demos[m] | and everything works, but after a build the deps.d file is deleted, and then the next invocation of ninja builds it |
20:44:15 | Demos[m] | can I prevent that? |
20:45:10 | * | zachk joined #nim |
20:46:54 | Demos[m] | oops |
20:47:00 | Demos[m] | wrong channel, sorta |
20:48:42 | dom96 | copygirl: you can just write a custom traverser too |
20:48:55 | dom96 | and save whatever you want into an object |
20:49:15 | dom96 | or just keep the JsonNode and access fields as-needed |
20:51:32 | copygirl | I like the compile time type hints. |
20:53:21 | * | zachk quit (Changing host) |
20:53:21 | * | zachk joined #nim |
21:06:26 | FromGitter | <mratsim> I’m proud of this christmas tree bug: https://github.com/nim-lang/Nim/issues/9497 ⏎ Combining threads + distinct type + generics into a internal compiler error =) |
21:08:17 | * | tribly_ is now known as tribly |
21:14:08 | copygirl | `type mismatch: got <ref NimNode> but expected one of: proc len(n: NimNode): int` ?? |
21:14:20 | copygirl | Can I not use `ref NimNode` in a macro, or..? |
21:14:47 | * | shadowbane joined #nim |
21:14:58 | copygirl | I guess NimNode is a magic type.. |
21:15:00 | FromGitter | <Araq> don't use `ref NimNode` |
21:15:21 | FromGitter | <Araq> but to turn a `ref T` into `T`, you use the deref operator `x[]` |
21:16:55 | copygirl | I want to recursively travel through the node tree and replace certain nodes. Thought that was the most straight-forward way. |
21:17:27 | copygirl | `x.len` should automatically be `x[].len` though for ref types, right? |
21:17:59 | FromGitter | <mratsim> NimNode are ref types already |
21:20:11 | copygirl | Oh, wait... then maybe I'm getting things mixed up again. |
21:20:52 | copygirl | How can I pass a reference to a proc so that it can *set* the value of that reference..? |
21:21:22 | copygirl | I thought `var x` means modifyable but not assignable and `ref x` meant both. Do I need a pointer, instead? |
21:24:05 | FromGitter | <mratsim> var means both |
21:25:01 | FromGitter | <mratsim> ref, you can modify `at` the memory pointed to (i.e. any property) (what is contained) but not the memory address you are pointing to (the container) |
21:25:49 | copygirl | Ah right, because foo(var int) means you can modify the integer, not just contents. |
21:26:00 | FromGitter | <mratsim> so if you pass `proc foo(a: ref Bar)` you can do a.field1 = 0 but you cannot do a = nil |
21:26:13 | FromGitter | <mratsim> yes |
21:26:40 | FromGitter | <mratsim> if you want to do `a = nil` in my example you would need to pass `var ref Bar` |
21:26:58 | copygirl | Aaand.. I don't suppose you can get a `var NimNode` child from another node? |
21:27:38 | copygirl | Since `node[i]` is sorta magic I'm not sure if that's possible. |
21:27:44 | FromGitter | <mratsim> I never add to pass a var NimNode, pass a normal NimNode and just modify what is inside |
21:27:54 | copygirl | Well I can probably do `node[i] = process(node[i])` |
21:28:03 | FromGitter | <mratsim> yeah, reassigning is easy |
21:28:09 | copygirl | Well the node might be replaced with another node. |
21:29:11 | FromGitter | <mratsim> oh yeah, I do use var NimNode, but that’s the only use case I have, it’s for a “pop()” function |
21:29:32 | FromGitter | <mratsim> and also for appending |
21:30:44 | copygirl | :thumbsup: |
21:36:58 | * | poopBot quit (Remote host closed the connection) |
21:46:15 | FromDiscord | <Shield> I'm trying to follow the second answer in https://stackoverflow.com/questions/17081131/how-can-a-shared-library-so-call-a-function-that-is-implemented-in-its-loader |
21:47:28 | FromDiscord | <Shield> using "-Wl,--export-dynamic", how can I forward declare a function in the nim library but have its implementation in main program? |
21:51:01 | dom96 | It's usually common to pass the NimNode and an index, and modify its children via `node[i] = ...` |
21:52:32 | * | fyber quit (Quit: Ping timeout (120 seconds)) |
21:53:04 | * | fyber joined #nim |
21:59:02 | Demos[m] | who's using --genDeps |
21:59:19 | FromDiscord | <treeform> Is there a way to redirect stdout (descriptor 1) in nim to a file (without using the shell)? |
21:59:36 | FromDiscord | <treeform> some thing like stdout = open("foo.txt", w)... ? |
21:59:48 | Demos[m] | I want to change it to: a) work without --compileOnly, Not imply --genScript, and output in the same format as gcc -MM |
22:01:06 | Demos[m] | @treeform: does it need to be portable? |
22:03:25 | Demos[m] | oh |
22:03:45 | Demos[m] | erm try `reopen(stdout, "foo.txt", fmWrite)` |
22:03:59 | Demos[m] | that should be just a call to libc's freopen |
22:04:15 | Demos[m] | and it works on my machine (tm) (Fedora 29 Workstation beta) |
22:04:19 | FromDiscord | <treeform> cool ill try that! |
22:04:46 | Demos[m] | rad |
22:05:03 | FromDiscord | <treeform> yeah that works great, thank you! |
22:05:13 | Demos[m] | hey who awesomeifyed the docs with little clickable pragma drawers |
22:05:16 | Demos[m] | they are awesome! |
22:05:26 | FromDiscord | <treeform> not me |
22:05:30 | FromDiscord | <treeform> but they are awsome |
22:05:46 | FromGitter | <zacharycarter> can I see an example? |
22:24:56 | * | kapil____ quit (Quit: Connection closed for inactivity) |
22:25:36 | dom96 | treeform: You'll have to do that via the OS APIs AFAIK |
22:25:50 | dom96 | There might be some package that does this already |
22:28:09 | copygirl | What's the difference between `copyNimNode` and `copyNimTree`? Is one recursive while the other isn't? |
22:39:30 | * | jjido joined #nim |
22:45:54 | FromGitter | <zacharycarter> copygirl: no - a Node is an individual node in the AST |
22:46:11 | FromGitter | <zacharycarter> well I guess yes it is for a short answer |
22:46:24 | FromGitter | <zacharycarter> but I mean - as soon as you have a parent / child relationship in terms of AST nodes |
22:46:33 | FromGitter | <zacharycarter> `copyNimTree` becomes relevant |
22:46:38 | FromGitter | <zacharycarter> in my understanding of things |
22:47:24 | * | PrimHelios_ joined #nim |
23:04:27 | * | PrimHelios_ quit (Ping timeout: 240 seconds) |
23:18:43 | * | rlr quit (Remote host closed the connection) |
23:21:51 | * | jjido quit (Remote host closed the connection) |
23:36:08 | * | xace quit (Ping timeout: 272 seconds) |
23:49:47 | * | xace joined #nim |
23:59:21 | * | ghost64 quit (Quit: See you!) |