00:05:47 | * | flyhigh joined #nim |
00:06:34 | FromGitter | <cyberlis> ok i've made it |
00:07:06 | FromGitter | <cyberlis> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5972972a76a757f80834982e] |
00:07:20 | FromGitter | <cyberlis> it compiles and works |
00:11:20 | * | flyhigh quit (Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org) |
00:11:36 | FromGitter | <cyberlis> but when i add a return type for function, it throws an error during compilation ⏎ `metaprogramming.nim(22, 9) Error: expression 'myFunc(45, 78, ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=597298374bcd78af56d39ed1] |
00:12:37 | * | Matthias247 quit (Read error: Connection reset by peer) |
00:20:54 | * | yingjun joined #nim |
00:23:42 | PMunch | https://github.com/PMunch/gtkgenui |
00:25:12 | * | yingjun quit (Ping timeout: 260 seconds) |
00:30:57 | * | couven92 quit (Ping timeout: 240 seconds) |
00:48:37 | * | PMunch quit (Quit: leaving) |
00:57:01 | * | deep-book-gk_ joined #nim |
00:59:31 | * | deep-book-gk_ left #nim (#nim) |
01:05:17 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
01:39:40 | * | chemist69 quit (Ping timeout: 255 seconds) |
01:42:47 | * | v17d quit (Quit: Leaving) |
01:53:16 | * | chemist69 joined #nim |
02:10:00 | * | yingjun joined #nim |
02:16:03 | * | dddddd quit (Remote host closed the connection) |
02:16:33 | * | yingjun quit (Ping timeout: 248 seconds) |
03:30:17 | * | endragor joined #nim |
03:43:12 | * | mahtob joined #nim |
03:47:40 | mahtob | hi |
03:48:01 | mahtob | i want to install jester |
03:48:28 | mahtob | nim has a command to get project-lib from github? |
03:48:42 | mahtob | or will i download it and put the under /usr/lib/nim/packages/ |
03:49:25 | * | endragor quit (Remote host closed the connection) |
03:51:08 | * | endragor joined #nim |
04:04:34 | gangstacat | mahtob, nimble install jester@#head |
04:05:09 | mahtob | ah ok +1 |
04:05:11 | mahtob | well |
04:05:49 | mahtob | how can i compile this ex |
04:05:50 | mahtob | http://ix.io/yCX |
04:06:29 | gangstacat | nim c -r file.nim |
04:07:52 | mahtob | sorry |
04:07:52 | mahtob | http://ix.io/yCY |
04:07:56 | mahtob | this ex |
04:08:11 | mahtob | Error: This module only works on the JavaScript platform |
04:08:17 | mahtob | it errors this |
04:14:12 | * | yingjun joined #nim |
04:18:35 | * | yingjun quit (Ping timeout: 240 seconds) |
04:25:06 | * | endragor quit (Remote host closed the connection) |
04:41:55 | * | endragor joined #nim |
04:53:49 | * | Jesin quit (Quit: Leaving) |
04:55:12 | * | Jesin joined #nim |
05:09:36 | * | SusWombat joined #nim |
05:09:46 | mahtob | http://ix.io/yCY |
05:10:01 | mahtob | how can we compile this? |
05:15:59 | * | jsgrant quit (Read error: Connection reset by peer) |
05:19:22 | * | jsgrant joined #nim |
05:31:06 | FromGitter | <ephja> mahtob: try 'nim js' instead |
05:32:25 | * | jsgrant quit (Remote host closed the connection) |
05:33:22 | mahtob | ok ephja i tried it |
05:33:30 | mahtob | but doesnt work with -r |
05:33:34 | mahtob | it builds |
05:33:42 | mahtob | but cannot run |
05:35:09 | mahtob | https://ncry.pt/p/c3Dn#2ecwIr5nQZDp7iX9qkFM8fFv-eq-Vj3uvqQcJ3B1YWk |
05:35:15 | mahtob | here is the result |
05:37:50 | * | user0 quit (Quit: user0) |
05:38:40 | FromGitter | <ephja> mahtob: https://nim-lang.org/docs/backends.html#backends-the-javascript-target |
05:39:10 | FromGitter | <ephja> I dunno if running with nodejs works with the DOM. if not then you might have to load it manually via a html file for example |
05:39:51 | FromGitter | <ephja> there should be a js file in the nimcache directory. you can output it elsewhere by doing 'nim js -o:<path> <nim_module>' |
06:20:28 | * | mahtob quit (Ping timeout: 255 seconds) |
06:54:35 | * | dankrad quit (Ping timeout: 240 seconds) |
06:56:33 | * | dankrad joined #nim |
06:57:29 | * | rauss quit (Quit: WeeChat 1.9) |
07:05:35 | * | Trioxin joined #nim |
07:08:36 | * | endragor quit (Remote host closed the connection) |
07:15:14 | * | yglukhov joined #nim |
07:16:22 | * | yingjun joined #nim |
07:19:35 | * | yglukhov quit (Ping timeout: 240 seconds) |
07:21:37 | * | yingjun quit (Ping timeout: 248 seconds) |
07:23:18 | * | v17d joined #nim |
07:28:59 | * | couven92 joined #nim |
07:38:36 | * | Trustable joined #nim |
08:00:01 | FromGitter | <mratsim> Fun programming quotes: https://henrikwarne.com/2016/04/17/more-good-programming-quotes/ |
08:01:12 | FromGitter | <mratsim> “Give someone a program, you frustrate them for a day; teach them how to program, you frustrate them for a lifetime.” — David Leinweber ⏎ ⏎ “C is memory with syntactic sugar.” — Dennis Kubes ⏎ ⏎ “Any sufficiently advanced bug is indistinguishable from a feature” — R. Kulawiec ... [https://gitter.im/nim-lang/Nim?at=597306484bcd78af56d4db07] |
08:01:56 | * | Trioxin quit (Quit: Konversation terminated!) |
08:05:39 | * | ShalokShalom joined #nim |
08:09:06 | * | endragor joined #nim |
08:12:29 | Araq | "Dynamic typing: The belief that you can’t explain to a computer why your code works, but you can keep track of it all in your head." |
08:13:35 | * | endragor quit (Ping timeout: 240 seconds) |
08:15:05 | Araq | “Sufficiently advanced trolling is indistinguishable from thought leadership.” |
08:15:25 | Araq | Linus??? |
08:17:55 | FromGitter | <ephja> I suspect that the dynamic paradigm is compared with old statically typed languages a lot |
08:19:18 | FromGitter | <ephja> well, some actually do have algebraic types and what not, don't they? but maybe they were not as popular |
08:24:44 | * | arnetheduck joined #nim |
08:25:26 | * | xet7 joined #nim |
08:34:55 | crem | Is there a way to tell nim to force me explicitly calling return or assigning to result? I often forgot return statement in python, and now with nim it's going to be the same. In python it fails somewhere later with "None" type where something else is expected, but I guess in nim it will be even harder to notice. |
08:37:42 | crem | Hm, actually most of the time it happens in Python when I build some result in a function and then forget to return it. In nim I can build result directly in "result" variable. |
08:39:40 | * | endragor joined #nim |
08:41:46 | * | dankrad quit (Ping timeout: 255 seconds) |
08:41:54 | Araq | yup. |
08:43:27 | * | dankrad joined #nim |
08:44:05 | * | endragor quit (Ping timeout: 240 seconds) |
08:55:16 | * | v17d quit (Ping timeout: 255 seconds) |
09:01:51 | crem | Does nim generate different code for different C compilers? Also why would one choose C++ instead of C as a target language? |
09:02:31 | Araq | yes, it takes advantage of C compiler specific features like __assume(false) |
09:02:47 | Araq | C++ produces way better exception handling code |
09:03:33 | crem | Makes sense, thanks. |
09:20:56 | * | arnetheduck quit (Ping timeout: 260 seconds) |
09:28:37 | FromGitter | <ephja> does setControlCHook not work when using async? 路 |
09:30:34 | * | skrylar quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
09:39:49 | Araq | should work |
09:48:58 | FromGitter | <ephja> I dunno what is going on. it gets ignored, and then it crashes with no stack trace after "SIGINT: Interrupted by Ctrl-C.". I'm gonna have to reduce it |
09:51:58 | FromGitter | <mratsim> @crem: If your proc has the proper type signature, it will not compile if result is void or you have no return statement |
09:52:17 | Araq | I would spawn a thread listening to input, setting a flag for the worker thread |
09:52:52 | Araq | Unix's signals are unusable. |
09:53:32 | Araq | I mean ok, they fit Unix perfectly well since everything else is unusable too, but still. |
09:54:26 | FromGitter | <ephja> I'm on windows, and the callback doesn't seem to be invoked. A minimal example with a hook works |
09:56:58 | FromGitter | <ephja> "Simple workaround on Windows for the near-term. You need to build with --threads:on and --tlsEmulation:off for this to work." |
09:58:59 | FromGitter | <ephja> that did the trick |
10:19:50 | * | yingjun joined #nim |
10:24:17 | * | yingjun quit (Ping timeout: 260 seconds) |
10:38:23 | * | Trustable quit (Quit: Leaving) |
11:06:20 | * | v17d joined #nim |
11:11:06 | * | endragor joined #nim |
11:12:42 | * | v17d quit (Ping timeout: 260 seconds) |
11:14:06 | * | PMunch joined #nim |
11:14:36 | PMunch | Hey Araq, any particular reason https://github.com/nim-lang/gtk2/pull/22 hasn't been merged yet? |
11:15:40 | * | endragor quit (Ping timeout: 255 seconds) |
11:18:54 | * | dddddd joined #nim |
11:25:06 | * | v17d joined #nim |
11:25:43 | * | Tiberium joined #nim |
11:26:54 | * | madmalik joined #nim |
11:37:03 | * | eldiz joined #nim |
11:40:00 | * | Arrrr joined #nim |
11:40:06 | * | mahtob joined #nim |
11:55:00 | Araq | guchar* = uint8 # sure about that one? |
12:02:56 | * | Snircle joined #nim |
12:07:27 | * | mahtob quit (Remote host closed the connection) |
12:17:55 | * | yuken left #nim ("Leaving") |
12:21:17 | * | Arrrr quit (Quit: Leaving.) |
12:21:31 | PMunch | According to this: https://developer.gnome.org/glib/stable/glib-Basic-Types.html#guchar a guchar is an unsigned char, which according to this: https://www.tutorialspoint.com/cprogramming/c_data_types.htm is a single byte unsigned (aka uint8). |
12:28:17 | * | dankrad quit (Ping timeout: 248 seconds) |
12:30:19 | * | dankrad joined #nim |
12:32:26 | * | PMunch_ joined #nim |
12:33:44 | * | PMunch quit (Ping timeout: 268 seconds) |
12:38:25 | * | smt joined #nim |
12:40:19 | * | kunev quit (Ping timeout: 255 seconds) |
12:41:30 | * | kunev joined #nim |
12:41:31 | PMunch_ | Araq ^ |
12:45:01 | PMunch_ | Is there a way in Nim to hide a field in an object in the same module? |
12:45:41 | PMunch_ | Like not adding a * in a module to be imported, but for types in the same file. |
13:05:20 | * | Tiberium quit (Remote host closed the connection) |
13:06:02 | subsetpark | You don't trust yourself? |
13:06:16 | PMunch_ | Haha, it's for a macro |
13:06:49 | PMunch_ | I want to create a type, hide all it's fields, and then override the special .= operator to trigger events on field updates :P |
13:07:46 | * | Trustable joined #nim |
13:08:06 | koppeh | AsyncSocket is a ref type.. so why can't I get its addr? |
13:08:31 | PMunch_ | koppeh, because you made it with a let statement? |
13:08:55 | koppeh | ref is a pointer though, right? |
13:11:31 | * | Trustable quit (Client Quit) |
13:16:41 | koppeh | Okay, so a little reasoning.. |
13:16:56 | koppeh | I want to get the hash of a ref so I can add it to a HashSet. |
13:17:19 | koppeh | I tried `client.addr.hash` since pointer has a hash proc. |
13:17:50 | * | Trustable joined #nim |
13:17:50 | koppeh | But it errors with "expression has no address". |
13:18:09 | koppeh | Just for the hell of it I tried `client[].addr.hash` ... which apparently works. |
13:19:09 | crem | Did you want the address of an object (value of a reference) or address of a reference? |
13:20:34 | PMunch_ | koppeh cast[int](client).hash |
13:21:05 | PMunch_ | As you say, client *is* a ref. What you are trying to do is get the address *to the ref*. |
13:21:09 | koppeh | PMunch_: That feels dirty. |
13:21:38 | koppeh | crem: Unsure of the difference. |
13:22:09 | * | yingjun joined #nim |
13:23:27 | koppeh | crem: Oh you mean the pointer to where the .. pointer value is residing in memory? |
13:23:56 | koppeh | Since I want to hash the location of the object, I want the former. |
13:24:01 | koppeh | (I guess?) |
13:24:37 | * | flyhigh joined #nim |
13:26:27 | * | yingjun quit (Ping timeout: 240 seconds) |
13:27:24 | PMunch_ | Yeah, so use cast[int](client).. |
13:27:39 | PMunch_ | That casts the reference to the client to an int which you can then use |
13:28:57 | Araq | PMunch_: but maybe gtk uses cuchar as chars moreso than bytes? |
13:30:37 | PMunch_ | So you're thinking "unsigned char" instead? |
13:39:47 | PMunch_ | Hmm .= gives the field as a string.. |
13:40:28 | PMunch_ | Araq, any idea on how to properly do this? I want to create an object and run different procedures silently on field updates. |
13:41:24 | Araq | declare the fields as field000 and generated accessors |
13:41:30 | Araq | *generate |
13:42:22 | PMunch_ | Hmm, is it safe to take a type definition into a macro and rewrite that? There are no weird special cases that would mess it up? |
13:43:27 | Araq | well mutate the type as an AST, not via getType() and you should be mostly fine |
13:43:47 | PMunch_ | Oh yeah, that was what I was planning to |
13:44:29 | PMunch_ | But how would I write the accessor? I'm looking at .= now but since it gets the field as a string it's not the best.. |
13:46:14 | PMunch_ | Aah, I can define `fieldname=` procedures |
13:46:36 | Araq | exactly |
13:48:31 | * | endragor joined #nim |
13:50:03 | PMunch_ | Hmm, but then I have to parse the typedef stuff to make the proper procedures.. |
13:53:00 | * | endragor quit (Ping timeout: 260 seconds) |
13:54:53 | * | Matthias247 joined #nim |
13:59:17 | * | Trustable quit (Remote host closed the connection) |
14:00:28 | Araq | it's not hard, search for nnkIdentDefs within the object declaration |
14:00:57 | PMunch_ | http://ix.io/yD9 why doesn't this works? |
14:01:26 | PMunch_ | Throws an error saying "Error: ':' or '=' expected, but found 'test' |
14:01:37 | PMunch_ | But is that safe Araq? |
14:02:42 | Araq | Nim is not homoiconic, 'x: T' has different AST representations |
14:03:03 | Araq | PMunch_: no idea what 'safe' means here |
14:03:36 | PMunch_ | Aah, yeah I noticed that when I was writing the nigui genui macro. Have some places were I request the string representation of something just to then reparse it.. |
14:04:05 | PMunch_ | Safe, as in can I do that for every possible object type definition without it doing something weird |
14:04:24 | PMunch_ | What if I declare a field to be a tuple for example? That's a completely different AST |
14:05:04 | Araq | well you check it's an nnkObjectTy, obviously |
14:06:51 | PMunch_ | This is why I wanted to just override the .= operator. Then I could simply take their code, wrap it in some hidden type, then create a type which had only one field with the hidden type, then just implement .= as "update the actual field in the hidden type and call x" |
14:07:17 | Araq | but then my method is safe, yes, if you do the recursion right |
14:08:34 | Araq | well I tell you to instead to "simply" take an object declaration, "just" to wrap the type properly and then "just" implement accessor generation |
14:08:49 | dom96 | Araq: Hah, I knew you would say that (the Nimble issue I created recently) |
14:09:16 | Araq | and with a bit more work I could insert more "justs" and "simplies" and then my solution would win in simplicity too |
14:09:24 | PMunch_ | -_- |
14:09:25 | Araq | :P |
14:09:41 | Araq | want me to write the macro? |
14:10:05 | FromGitter | <ephja> when in doubt, write a macro |
14:10:25 | Araq | dom96: well that's what I did two days ago |
14:11:03 | PMunch_ | My solution though wouldn't really need to parse the code passed in at all |
14:11:07 | Araq | but yes, "test for feature" is as much work to implement as "test for version", it's a general rule. and it produces better results. |
14:11:58 | Araq | my solution doesn't require parsing either because it's wrong to call an AST analysis "parsing" |
14:12:04 | dom96 | Araq: yeah, I told federico3 the same thing heh. But he does have a point about semantic differences possibly being a problem in the future. |
14:12:14 | Araq | it was already parsed, it's an AST now. |
14:12:54 | PMunch_ | Hmm, I think I'm over thinking this.. |
14:12:56 | dom96 | I don't suppose anyone else here is in Dublin and has a free Saturday? :) |
14:13:07 | * | rauss joined #nim |
14:13:08 | Araq | come on, everything is a "possible problem in the future" |
14:14:04 | dom96 | *shrug* |
14:14:11 | dom96 | I don't want to waste time on this. |
14:14:14 | dom96 | today at least :) |
14:17:36 | * | flyhigh quit (Quit: Konversation terminated!) |
14:17:44 | * | flyhigh joined #nim |
14:18:41 | * | Trustable joined #nim |
14:27:44 | koppeh | Mhh.. is there a way to import a module without having it take up a name? |
14:28:24 | koppeh | `import ./server; let server = newServer()` shows "redefinition of 'server'" |
14:30:12 | * | endragor joined #nim |
14:30:14 | FromGitter | <ephja> don't function local variables solve these errors? |
14:30:54 | koppeh | Ahh.. that's why that error went away in the other project. |
14:31:02 | FromGitter | <ephja> I always define an entry point proc for that reason and other reasons |
14:31:23 | koppeh | Hmm.. well I'll need it anyway so let's do that! |
14:32:37 | FromGitter | <ephja> dom96: did any recent async changes resolve some stack trace issues? |
14:33:23 | koppeh | Mhh.. does this main function have to be called in the global scope? |
14:35:00 | * | endragor quit (Ping timeout: 260 seconds) |
14:35:16 | koppeh | Yup. |
14:36:08 | FromGitter | <ephja> that makes the most sense |
14:36:19 | Araq | PMunch_: https://gist.github.com/Araq/46988d814ed3a142eac7c55f092eb2f6 |
14:36:37 | Araq | the only problem is that the compiler still doesn't understand type(MyObject.field) |
14:36:55 | Araq | but I'm looking into it |
14:38:44 | dom96 | ephja: i'm not sure, why? |
14:39:09 | Araq | oh well, I updated my gist, now it works |
14:39:32 | Araq | koppeh: also possible, 'import server as serverModule' |
14:40:17 | koppeh | `import server as nil` would be nice. |
14:40:22 | Araq | anyway, it wasn't that hard. exercise for the reader: Make it work with export markers (field*: type) |
14:40:29 | Araq | hmmm |
14:42:07 | koppeh | Basically the opposite of `from server import nil`, right? |
14:44:57 | * | Sentreen quit (Ping timeout: 240 seconds) |
14:46:39 | Araq | right |
14:46:42 | FromGitter | <ephja> dom96: certain parts of the trace were missing before I think |
14:46:43 | Araq | I like it |
14:46:57 | * | dankrad quit (Ping timeout: 248 seconds) |
14:47:02 | dom96 | ephja: are they not anymore |
14:47:08 | dom96 | ? |
14:48:03 | FromGitter | <ephja> no issues AFAICT. I've implemented a simple chat client and server |
14:50:09 | * | v17d quit (Ping timeout: 248 seconds) |
14:50:37 | FromGitter | <ephja> |
14:52:29 | FromGitter | <ephja> channels + variants for thread communication |
14:55:03 | Araq | dom96: if you don't waste time on this, don't introduce versioning. |
14:58:19 | * | Sentreen joined #nim |
15:01:03 | * | endragor joined #nim |
15:03:42 | * | kunev quit (Ping timeout: 260 seconds) |
15:05:39 | * | endragor quit (Ping timeout: 255 seconds) |
15:06:09 | * | kunev joined #nim |
15:06:17 | * | v17d joined #nim |
15:10:26 | * | kunev quit (Ping timeout: 240 seconds) |
15:10:49 | * | endragor joined #nim |
15:11:39 | * | kunev joined #nim |
15:15:21 | * | Tiberium joined #nim |
15:15:45 | * | v17d quit (Ping timeout: 248 seconds) |
15:22:47 | * | endragor quit (Remote host closed the connection) |
15:29:18 | * | v17d joined #nim |
15:41:04 | * | Matthias247 quit (Read error: Connection reset by peer) |
15:41:58 | * | Tiberium quit (Remote host closed the connection) |
15:42:12 | PMunch_ | Oh wow, you actually wrote it. Thanks :) |
15:43:27 | * | Tiberium joined #nim |
15:51:39 | * | Tiberium quit (Remote host closed the connection) |
15:52:21 | Araq | I had to prove it is not hard |
15:52:56 | * | Tiberium joined #nim |
15:53:09 | PMunch_ | Haha, well done in that case :) |
15:53:16 | PMunch_ | This seems to work nicely |
15:53:28 | PMunch_ | Even handles multiple objects |
15:58:32 | * | Tiberium quit (Remote host closed the connection) |
15:59:53 | * | Tiberium joined #nim |
16:00:52 | * | rkjy joined #nim |
16:01:35 | * | PMunch_ quit (Quit: leaving) |
16:15:11 | * | Tiberium quit (Remote host closed the connection) |
16:16:33 | * | Tiberium joined #nim |
16:18:04 | * | v17d quit (Remote host closed the connection) |
16:23:08 | * | flyhigh quit (Ping timeout: 246 seconds) |
16:23:16 | * | flyhigh joined #nim |
16:27:20 | * | mahtob joined #nim |
16:27:37 | mahtob | i compiled https://github.com/dom96/snake |
16:27:45 | mahtob | but when i run snake.js |
16:27:55 | mahtob | nimcache/snake.js:6824:0 ReferenceError: window is not defined |
16:28:24 | dom96 | snake isn't a node app |
16:28:28 | dom96 | It's for the browser |
16:29:16 | mahtob | how can we run it |
16:29:29 | dom96 | You need an html file |
16:29:46 | mahtob | hm |
16:29:49 | dom96 | Just open this: https://github.com/dom96/snake/blob/master/public/index.html |
16:29:51 | mahtob | like your present |
16:30:01 | mahtob | https://picheta.me/snake/ |
16:30:02 | dom96 | make sure the .js file is in the public directory |
16:30:06 | mahtob | hm ok |
16:30:59 | mahtob | thnks it worked :) |
16:53:13 | * | Ven joined #nim |
16:53:37 | * | Ven is now known as Guest13273 |
16:56:29 | * | skrylar joined #nim |
16:56:36 | skrylar | billy mays here with another fantastic... wait. |
17:15:06 | * | mahtob quit (Remote host closed the connection) |
17:17:50 | * | endragor joined #nim |
17:24:45 | * | yingjun joined #nim |
17:25:58 | * | jsgrant joined #nim |
17:28:56 | * | yingjun quit (Ping timeout: 240 seconds) |
17:33:52 | * | flyhigh quit (Quit: Konversation terminated!) |
17:48:20 | * | rkjy quit (Quit: ChatZilla 0.9.93 [Firefox 54.0/20170616104331]) |
18:04:56 | * | v17d joined #nim |
18:04:56 | * | Matthias247 joined #nim |
18:11:42 | * | Tiberium quit (Remote host closed the connection) |
18:12:20 | * | planhths joined #nim |
18:17:48 | FromGitter | <Varriount> Araq: u |
18:18:35 | * | Jesin quit (Ping timeout: 240 seconds) |
18:19:39 | Araq | varriount: well? |
18:20:04 | * | Jesin joined #nim |
18:28:26 | * | v17d quit (Read error: Connection reset by peer) |
18:30:04 | * | yglukhov joined #nim |
18:31:11 | * | Jesin quit (Quit: Leaving) |
18:31:34 | * | Jesin joined #nim |
18:33:34 | * | yglukhov quit (Remote host closed the connection) |
18:36:34 | * | yglukhov joined #nim |
18:38:57 | * | Guest13273 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:42:34 | * | endragor quit (Remote host closed the connection) |
18:48:54 | * | yglukhov quit (Remote host closed the connection) |
18:56:46 | * | Ven joined #nim |
18:57:10 | * | Ven is now known as Guest6808 |
19:02:39 | * | v17d joined #nim |
19:04:14 | * | Trioxin joined #nim |
19:10:18 | * | ShalokShalom_ joined #nim |
19:10:25 | * | ShalokShalom quit (Ping timeout: 255 seconds) |
19:19:21 | * | v17d quit (Remote host closed the connection) |
19:20:48 | * | chra94 joined #nim |
19:21:22 | * | chra94 left #nim ("Leaving") |
19:26:48 | * | yingjun joined #nim |
19:26:54 | * | chra94 joined #nim |
19:27:32 | FromGitter | <cyberlis> i can't figure out why this code does not compile ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ if i remove return type for the function, everything works great. But i need to return some value from function [https://gitter.im/nim-lang/Nim?at=5973a724bc46472974163248] |
19:30:48 | * | ShalokShalom_ quit (Ping timeout: 240 seconds) |
19:31:05 | skrylar | cyberlis: the "has to be discarded" message usually means you are returning a value from a function, yet the caller is not using it |
19:31:13 | * | yingjun quit (Ping timeout: 248 seconds) |
19:31:29 | skrylar | unless that value is going in to a variable you need to prepend 'discard' to the call site, ex. "discard getMonkeys()" |
19:31:43 | FromGitter | <cyberlis> i know that |
19:31:50 | FromGitter | <cyberlis> that's why i wrote |
19:32:00 | FromGitter | <cyberlis> ```var i = myFunc@(45, 78, hello="world", name="cyberlis", qwerty="xxxxx")``` |
19:32:08 | FromGitter | <cyberlis> this is last line of code |
19:32:40 | FromGitter | <cyberlis> because it doesn't work as has to work, i asked this question |
19:33:27 | * | ShalokShalom joined #nim |
19:33:33 | FromGitter | <cyberlis> and of course i tried `discard` |
19:33:35 | * | chra94 quit (Ping timeout: 240 seconds) |
19:34:13 | FromGitter | <cyberlis> i think something wrong in my macro function. may be return value has to be something else |
19:35:11 | skrylar | the paste looks jumbled up to me |
19:35:21 | skrylar | there's a return 10 line where there is no function definition for instance |
19:36:48 | * | yglukhov joined #nim |
19:36:58 | FromGitter | <cyberlis> i will post pastebin |
19:38:35 | FromGitter | <cyberlis> https://glot.io/snippets/erz039dx31 |
19:38:46 | FromGitter | <cyberlis> you can run it in the brrowser |
19:41:42 | * | ShalokShalom quit (Ping timeout: 268 seconds) |
19:42:39 | * | v17d joined #nim |
19:59:31 | * | v17d quit (Ping timeout: 255 seconds) |
20:02:09 | planhths | why don't you just ```myFunk(45, 78, {"hello":"world", "name":"cyberlis", "qwerty":"xxxxx"}.toTable)``` |
20:02:23 | planhths | write this instead |
20:02:32 | FromGitter | <cyberlis> :) |
20:02:54 | Araq | cyberlis: the macro needs to return 'untyped' and then it works |
20:03:04 | * | Trioxin quit (Ping timeout: 260 seconds) |
20:03:06 | planhths | oh you are trying to emulate kwards from python |
20:03:13 | FromGitter | <cyberlis> Yes |
20:03:22 | FromGitter | <cyberlis> THANK YOU |
20:03:26 | FromGitter | <cyberlis> it works |
20:03:53 | Araq | sorry about the inconvenience, known compiler issue ;-) |
20:04:02 | planhths | is that thing possible? |
20:04:11 | Araq | planhths: sure |
20:04:11 | FromGitter | <cyberlis> it works |
20:05:31 | * | v17d joined #nim |
20:07:29 | * | planhths quit (Quit: Konversation terminated!) |
20:08:23 | FromGitter | <cyberlis> to make this more awesome i wanna get function defenition, and get a defenition of the `kwargs` argument. To use right types for kwargs |
20:11:31 | Araq | https://glot.io/snippets/erz0zzko28 |
20:11:42 | Araq | would be more idiomatic IMO |
20:12:26 | FromGitter | <cyberlis> cool. Looks great |
20:14:00 | FromGitter | <cyberlis> but if table will be `Table[string, int]` |
20:14:22 | FromGitter | <cyberlis> how i can make it more universal. |
20:14:51 | FromGitter | <cyberlis> fist type of course `string`, but second type can by anything |
20:17:13 | FromGitter | <cyberlis> yes it is more idiomic, but it loses `kwargs` magic. You can use just `toToble` instead `kwargs` |
20:17:22 | FromGitter | <cyberlis> because it looks the same |
20:17:58 | FromGitter | <cyberlis> but with `funcName@(args)` it looks more beautiful, i think. But may be i'm wrong |
20:18:09 | Araq | kwargs(foo=4, bar=5) vs toTable({"foo": "4", "bar": "5"}) |
20:18:22 | FromGitter | <cyberlis> oh, i see |
20:19:24 | Araq | types can never be "anything", types are about restricting things to sanity |
20:20:02 | Araq | you can use Table[string, JsonNode] and in my macro instead of bindSym"$" use bindSym"%" |
20:20:48 | FromGitter | <cyberlis> hm, interesting. i will try it. Thank you very much |
20:21:08 | Araq | but I would avoid it ;-) |
20:21:35 | FromGitter | <cyberlis> i want it for external REST API |
20:22:19 | FromGitter | <cyberlis> to feed any params to function as kwargs, then serialize them to json and send to server |
20:22:56 | FromGitter | <cyberlis> this can make my lib easier to use |
20:24:26 | Araq | I doubt kwargs gains you anything for that. instead you need a macro that generates the stubs |
20:29:10 | FromGitter | <cyberlis> and i wanted to use nims metaprogramming features. If you started using nim you have to try all awesome features it suggest |
20:30:39 | Araq | sure, no problem with that |
20:31:10 | Araq | but as I said, you probably want a macro that generates the stubs, how do keyword args help you |
20:32:38 | FromGitter | <cyberlis> they can make code simplier. This api gets method name in url, and some json object |
20:32:53 | FromGitter | <cyberlis> i don't want to write function for each method call |
20:33:10 | FromGitter | <cyberlis> i decided to write some super general function |
20:35:24 | FromGitter | <cyberlis> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5973b70b4bcd78af56d72570] |
20:35:57 | * | skrylar quit (Quit: Leaving) |
20:36:31 | FromGitter | <cyberlis> in this case, i don't have to write all function wrappers myself. And user only need to know server api documentation |
20:37:14 | * | arnetheduck joined #nim |
20:37:15 | FromGitter | <cyberlis> I think you get the idea |
20:38:18 | FromGitter | <cyberlis> And this is very good task for training some nim metaprogramming skills |
20:42:12 | FromGitter | <cyberlis> sorry i've spent so much of your time :) |
20:43:47 | Araq | what? you mean the 5 minutes? |
20:43:56 | Araq | you are welcome |
20:44:04 | FromGitter | <cyberlis> thank you ) |
20:44:29 | * | chra94 joined #nim |
20:56:00 | couven92 | Araq, while doing som FFI with Windows SDK, I was htinking about a macro module that automagically creates distinct types wth stringify and arithmatic operations for C define constant groups |
20:59:33 | couven92 | Araq, like this: https://gist.github.com/couven92/7d33f6bafcb2d20fbad11b58d46ebd6d is that General Purpose enough that I should make a public nimble for that? |
21:06:13 | Araq | result.add(infixBorrowOperatorProc(`distinct`, base, "!=", docString = "Inequality operator for $# values. $#" % [$`distinct`, eqNeqSuffix])) |
21:06:21 | Araq | do not ever generate a != operator |
21:06:29 | Araq | it's unnecessary |
21:06:46 | couven92 | okay...? |
21:06:53 | couven92 | do explain :D |
21:13:10 | Araq | template `!=`(x, y: untyped): untyped = not (x == y) |
21:13:16 | couven92 | AH! |
21:13:26 | couven92 | :) Okay, that makes sense! |
21:13:27 | Araq | it's in system.nim, works for everything |
21:14:30 | couven92 | I was too bound to C# there... If you overload == C# prompts you to also overload != |
21:14:52 | couven92 | s/overload/override |
21:14:57 | * | ftsf_ quit (Ping timeout: 240 seconds) |
21:15:21 | Araq | sometimes Nim works better than C# :P |
21:15:35 | * | madmalik quit (Quit: Connection closed for inactivity) |
21:15:54 | couven92 | Yeah, I've noticed!!!! :D (Which is high praise coming from a C# lover like me! ;)) |
21:16:52 | FromGitter | <cyberlis> guys, do you know some NoSQL database for nim. to store json objects, and serverless. Like Mongo but Like sqlite |
21:17:55 | couven92 | @cyberlis Uhm... Mongo IS NoSQL, right? And SQLite IS relational... make up your mind, what do you want? |
21:18:05 | Araq | as he said |
21:18:13 | Araq | serverless like sqlite |
21:18:17 | Araq | json based like mongo |
21:18:22 | FromGitter | <cyberlis> yes |
21:18:29 | couven92 | ah! okay :) |
21:19:11 | couven92 | (no idea, I don't do serverless (yet) :P) |
21:21:20 | Araq | https://github.com/nodesocket/jsonlite |
21:21:36 | Araq | written in Bash apparently |
21:23:32 | FromGitter | <cyberlis> it is convinient. if i would give your app to your friend. he don't have to setup database server to run it |
21:24:41 | Araq | https://unqlite.org/ |
21:24:47 | Araq | seems your best option |
21:25:52 | FromGitter | <cyberlis> thanks |
21:28:19 | * | yingjun joined #nim |
21:32:52 | * | chra94 quit (Remote host closed the connection) |
21:33:22 | * | yingjun quit (Ping timeout: 276 seconds) |
21:43:13 | * | Matthias247 quit (Read error: Connection reset by peer) |
21:44:40 | * | Trustable quit (Remote host closed the connection) |
22:08:45 | * | nsf joined #nim |
22:10:25 | * | mahtob joined #nim |
22:14:19 | * | v17d quit (Ping timeout: 276 seconds) |
22:23:57 | * | PMunch joined #nim |
22:26:43 | * | v17d joined #nim |
22:35:47 | * | Guest6808 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:43:12 | * | yglukhov quit (Remote host closed the connection) |
23:03:11 | * | deep-book-gk_ joined #nim |
23:03:30 | * | deep-book-gk_ left #nim (#nim) |
23:05:53 | * | PMunch quit (Quit: leaving) |
23:16:55 | * | couven92 quit (Ping timeout: 268 seconds) |
23:19:54 | * | nsf quit (Quit: WeeChat 1.9) |
23:25:11 | federico3 | very interesting |
23:29:51 | * | yingjun joined #nim |
23:34:42 | * | yingjun quit (Ping timeout: 260 seconds) |
23:38:19 | * | xet7 quit (Quit: Leaving) |
23:43:39 | * | yglukhov joined #nim |