00:03:07 | * | marenz_ joined #nim |
00:05:12 | * | Ven` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
00:37:49 | * | ludocode joined #nim |
00:38:43 | * | MJCaley joined #nim |
00:40:37 | user0 | Hi. The error message says that the compiler cannot insantiate StackObj. Not very helpful. What am I doing wrong? https://play.nim-lang.org/?gist=72761afd37d872771e9e8efcde38df65 |
00:45:45 | * | dddddd quit (Remote host closed the connection) |
01:09:28 | * | marenz_ quit (Ping timeout: 268 seconds) |
01:19:51 | * | craigger quit (Quit: bye) |
01:23:56 | * | craigger joined #nim |
01:25:06 | * | craigger quit (Client Quit) |
01:27:33 | * | mal`` quit (Quit: Leaving) |
01:28:34 | * | craigger joined #nim |
01:31:45 | * | craigger quit (Client Quit) |
01:33:57 | * | tinAndi quit (Ping timeout: 264 seconds) |
01:37:21 | * | mal`` joined #nim |
01:40:48 | * | craigger joined #nim |
01:55:36 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
01:59:47 | * | craigger quit (Quit: bye) |
02:10:44 | * | craigger joined #nim |
02:13:47 | * | craigger quit (Client Quit) |
02:22:09 | * | chemist69 quit (Ping timeout: 265 seconds) |
02:23:01 | * | craigger joined #nim |
02:25:10 | * | craigger quit (Client Quit) |
02:27:49 | * | MJCaley quit (Quit: MJCaley) |
02:28:29 | * | sz0 joined #nim |
02:29:23 | * | craigger joined #nim |
02:34:28 | * | craigger quit (Quit: bye) |
02:35:32 | * | chemist69 joined #nim |
02:40:46 | * | craigger joined #nim |
03:01:32 | * | craigger quit (Quit: bye) |
03:02:08 | * | gokr quit (Quit: Leaving.) |
03:03:24 | * | craigger joined #nim |
03:37:47 | * | vlad1777d quit (Ping timeout: 256 seconds) |
04:04:18 | * | endragor joined #nim |
04:05:22 | * | endragor quit (Remote host closed the connection) |
04:05:56 | * | endragor joined #nim |
04:16:14 | * | yglukhov joined #nim |
04:20:45 | * | yglukhov quit (Ping timeout: 264 seconds) |
04:37:23 | * | sz0 quit (Quit: Connection closed for inactivity) |
04:57:17 | GitDisc | <awr> @user0 the return type of newStackObj should be StackObj[T] instead of just StackObj |
04:59:45 | * | c0ntribut0r quit (Ping timeout: 260 seconds) |
05:00:11 | user0 | Thank you, awr |
05:01:02 | * | c0ntribut0r joined #nim |
05:22:55 | * | c0ntribut0r quit (Ping timeout: 268 seconds) |
05:23:38 | * | c0ntribut0r joined #nim |
05:30:07 | * | c0ntribut0r quit (Ping timeout: 248 seconds) |
05:32:58 | * | c0ntribut0r joined #nim |
05:40:36 | * | tinAndi joined #nim |
05:41:13 | * | user0 quit (Quit: user0) |
05:41:35 | * | c0ntribut0r quit (Read error: Connection reset by peer) |
05:41:46 | Araq | hmm does anybody know here how asymmetric encryption really works? |
05:41:53 | * | c0ntribut0r joined #nim |
05:50:23 | * | tinAndi quit (Ping timeout: 248 seconds) |
06:04:02 | * | gokr joined #nim |
06:18:17 | * | nsf joined #nim |
06:31:54 | * | Lord_Nightmare2 joined #nim |
06:33:05 | * | Lord_Nightmare quit (Ping timeout: 260 seconds) |
06:33:06 | * | Lord_Nightmare2 is now known as Lord_Nightmare |
06:44:27 | * | cspar__ quit (Ping timeout: 240 seconds) |
06:54:05 | * | c0ntribut0r quit (Ping timeout: 260 seconds) |
06:54:43 | * | c0ntribut0r joined #nim |
06:55:31 | * | cspar joined #nim |
07:00:00 | * | endragor quit (Remote host closed the connection) |
07:03:54 | * | c0ntribut0r quit (Ping timeout: 246 seconds) |
07:05:34 | * | c0ntribut0r joined #nim |
07:05:55 | * | rauss quit (Quit: WeeChat 2.0.1) |
07:07:08 | * | rauss joined #nim |
07:13:16 | * | solitudesf joined #nim |
07:16:22 | * | cspar_ joined #nim |
07:19:27 | * | cspar quit (Ping timeout: 240 seconds) |
07:24:10 | * | couven92 joined #nim |
07:25:45 | * | endragor joined #nim |
07:27:51 | FromGitter | <data-man> @Araq: What's so complicated? Simple math. :) |
07:30:05 | * | endragor quit (Ping timeout: 240 seconds) |
07:32:53 | Araq | thanks, got it covered, never mind |
07:34:57 | miran | Araq: yesterday you talked about cleaning up some keywords.... how about `countup` and `countdown`? |
07:35:56 | Araq | these are not keywords. |
07:36:10 | Araq | and what's wrong with them? |
07:37:37 | miran | 1. feels strange do have different names depending if you're going up and down. 2. there's no `..` equivalent when the step is not 1 |
07:39:00 | Araq | on the contrary, using the same word for both directions doesn't work. |
07:39:04 | miran | is there a possibility to have something like: `5 .. 15 | 2` or `5, 7, .. 15` or something that has a possibility to define a step? |
07:39:34 | Araq | sure but not covered by the stdlib |
07:40:19 | miran | ah, ok.... :'( |
07:48:07 | * | dddddd joined #nim |
07:54:37 | * | c0ntribut0r quit (Ping timeout: 268 seconds) |
07:55:50 | * | c0ntribut0r joined #nim |
07:57:44 | Araq | miran: countdown is rare, countup not and so "countup by 1" got the ".." shortcut |
07:58:56 | * | endragor joined #nim |
07:59:01 | miran | Araq: ...and "countup by X" is also rare, so no need for shortcut, i guess? |
07:59:11 | Araq | yes |
08:07:27 | gokr | Ok, so I am battling the endless gc-safe issues... Could I mark procs as safe? |
08:08:36 | gokr | I am trying to make the nim-mqtt wrapper work unblocking and... I get a proc saying "is not GC-safe as it performs an indirect call here" |
08:09:30 | gokr | We talked about this Araq, but... I don't recall exactly what we ... said. |
08:10:03 | Araq | me neither |
08:10:27 | Araq | if you are in control of the "proc callback type", add a {.gcsafe.} to this type |
08:10:44 | Araq | if not, you're kind of losing the game but can make the compiler shut up via |
08:10:49 | Araq | {.gcsafe.}: |
08:10:50 | gokr | Mmmm. |
08:10:53 | Araq | code block here |
08:11:35 | gokr | Hmmm, I thought I just did. |
08:11:54 | gokr | oh, ok, perhaps another on. |
08:11:57 | gokr | one. |
08:14:47 | Araq | miran: https://gist.github.com/Araq/701565f110abd65801fbaea03143c24d |
08:16:32 | gokr | I'll be damned if I didn't get it to work. |
08:16:33 | * | c0ntribut0r quit (Read error: Connection reset by peer) |
08:16:39 | * | endragor quit (Remote host closed the connection) |
08:16:42 | gokr | Not sure if it will blow up, but... hasn't yet. |
08:17:06 | gokr | Now I just need federico3 to fix up nim-httpauth :) |
08:17:18 | gokr | federico3: Yo man! ;) |
08:20:22 | * | c0ntribut0r joined #nim |
08:22:13 | * | endragor joined #nim |
08:23:32 | * | endragor quit (Remote host closed the connection) |
08:23:39 | * | endragor joined #nim |
08:30:56 | * | floppydh joined #nim |
08:32:03 | * | yglukhov joined #nim |
08:33:12 | * | xkapastel quit (Quit: Connection closed for inactivity) |
08:49:40 | * | PMunch joined #nim |
08:50:01 | * | c0ntribut0r quit (Ping timeout: 256 seconds) |
08:50:22 | * | c0ntribut0r joined #nim |
08:50:32 | miran | Araq: nice, thanks! |
08:53:27 | * | yglukhov quit (Ping timeout: 240 seconds) |
08:53:27 | FromGitter | <Bennyelg> @Araq, this piece of code blowed my mind. Nim is so clean & beautiful 🔥 |
08:54:51 | miran | ...to bad it won't be in the stdlib ;) |
08:54:55 | miran | *too |
08:55:32 | Araq | I don't mind putting it the stdlib, but I do mind more system.nim extensions |
08:56:30 | Araq | (btw the code can be simplified further) |
08:57:09 | miran | to me this syntax is much more beautiful/elegant than using countup/countdown whenever i'm not increasing by one |
08:59:29 | * | dddddd quit (Remote host closed the connection) |
09:00:02 | miran | fsharp has `1..2..9`, haskell has `2,4..20` |
09:01:08 | miran | arraymancer has `2..10|2` |
09:03:27 | * | gmpreussner quit (Ping timeout: 248 seconds) |
09:05:27 | * | gmpreussner joined #nim |
09:05:32 | * | yglukhov joined #nim |
09:06:05 | * | gangstacat quit (Ping timeout: 256 seconds) |
09:10:42 | * | Arrrr joined #nim |
09:10:42 | * | Arrrr quit (Changing host) |
09:10:42 | * | Arrrr joined #nim |
09:29:03 | FromGitter | <alehander42> stepping syntax would be nice indeed, wondered about that and registered countup/countdown as translations in py2nim for that purpose |
09:36:03 | * | Vladar joined #nim |
09:38:40 | FromGitter | <tim-st> tikz has {1,7,...,n} |
09:45:24 | * | stisa quit (Remote host closed the connection) |
09:59:55 | * | Yardanico joined #nim |
10:04:49 | * | c0ntribut0r quit (Read error: Connection reset by peer) |
10:07:33 | * | c0ntribut0r joined #nim |
10:29:45 | * | user0 joined #nim |
10:30:53 | * | sz0 joined #nim |
10:35:29 | * | AndroUser9 joined #nim |
10:41:49 | * | Vladar quit (Remote host closed the connection) |
10:44:40 | Yardanico | hmm wait, does nim search for .so library in current program directory? it seems it doesn't for me |
10:44:50 | Yardanico | (with dynlib pragma) |
10:45:33 | Yardanico | copying this .so files to one of these directories work, but I don't want to copy my .so to system libs :) |
10:45:52 | user0 | While creating a stack data structure is it more reasonable to use linked list or just plain vectors? |
10:46:26 | * | BitPuffin joined #nim |
10:46:34 | Araq | seq |
10:46:54 | Araq | Yardanico: it doesn't do that because it wouldn't be Unixy. |
10:47:11 | Araq | Unixy is another word for "broken". |
10:47:29 | Yardanico | Araq, hmm, ok then |
10:51:29 | * | solitudesf quit (Quit: solitudesf) |
10:55:33 | * | c0ntribut0r quit (Ping timeout: 264 seconds) |
10:55:59 | gokr | Sorry to say I need to drop Nim from the getcanoe.io project. I have now been banging my head against the mqtt library for hours and I just can't make this stuff work. |
10:59:40 | Araq | gokr: we can help if we can see some code snippets |
11:00:48 | gokr | Yeah, but... it's unfortunately a pattern emerging. Jester is async, redis is async. Ok, fine. Then mqtt is not async, so... PAIN. |
11:01:27 | gokr | And I can't make it play nice - it was hard enough to whip up a thread with a channel etc - so that I could at least publish. |
11:02:09 | gokr | But... getting these callbacks going - I am failing it. foreignThreadGC and allocShared and whatnot - I have no idea. And then it's not even integrated with the asyncdistpatch stuff. |
11:03:14 | gokr | Also, canoed dies 2-3 times per day, buffer overflow somewhere down in libc. |
11:04:16 | gokr | So even if the HTTP and JSON parts are kinda nice... well, I dunno. I have too little spare time. |
11:04:34 | Araq | :-( understandable |
11:05:03 | gokr | I tried integrating nim-httpauth but ... it failed too - since my MQTT code uses threads:on and a channel - and nim-httpauth blew up on gc-safe-stuff. |
11:05:39 | gokr | So ... hours piling up and feeling out of depth to fix these things. |
11:07:34 | gokr | It's basically the MQTT bits that's missing. Had there been an async MQTT lib, perhaps things would have played out fine. |
11:08:02 | gokr | redis, postgres, Jester - that stuff works fine. |
11:08:07 | Yardanico | What is the current way to convert array of chars to cstring? cstring(addr module.name) ? |
11:08:33 | Yardanico | module.name is an array of chars |
11:09:15 | Araq | Yardanico: seems correct |
11:09:37 | Araq | gokr: yeah there are so many protocols that Nim lacks support for -.- |
11:09:45 | PMunch | gokr, wait what are you doing? |
11:09:52 | PMunch | This is the MQTT to web thing right? |
11:10:15 | gokr | PMunch: I started a project to build a cross platform wallet (with server side) for Raiblocks. |
11:10:18 | gokr | getcanoe.io |
11:10:41 | Araq | gokr: is it open source? if so you can push it to a branch and let me have a look at the .gcsafe problems |
11:10:44 | gokr | We are 4 people working on it, almost 27 people joined up doing translation of the app, quite a lot of momentum. |
11:10:51 | gokr | All open source |
11:11:01 | * | Vladar joined #nim |
11:11:47 | gokr | So the wallet communicates with the backend at getcanoe.io - using both HTTP (Jester) and MQTT was the idea. |
11:12:14 | gokr | The backend in turn talks to a rai_node (the official Raiblocks node) using HTTP RPC. |
11:13:27 | PMunch | Right |
11:13:28 | gokr | Araq: I can put out what I have. I hacked around inside mqtt - to try making it work async (not asyncdispatch). But I got stuck. |
11:13:47 | PMunch | But why do you need MQTT to be async? |
11:14:09 | * | gangstacat joined #nim |
11:14:30 | gokr | Jester code needs to publish and subscribe to MQTT stuff. Right now.. it does so via a channel to another thread, but that thread makes blocking calls to the mqtt lib. |
11:14:48 | gokr | with 20 ms timeout, so a kindof loop there. |
11:15:31 | gokr | It feels really icky, but... ok, fine, I could perhaps live with that. |
11:16:08 | * | c0ntribut0r joined #nim |
11:16:22 | gokr | But then I failed with nim-httpauth since it doesn't like threads:on |
11:16:50 | gokr | And well, rabbit hole started. |
11:17:09 | PMunch | What blocking calls? I had a look at the MQTT wrapper and it seems like it would be a simple matter to just set up one callback, then keep a list or table of topic->channel bindings and have it find the correct channel to send the message over back to the Jester code |
11:17:31 | PMunch | Yeah the httpauth/threads:on issue sounds a bit worse.. |
11:17:36 | gokr | Things just keep biting me. Like... redis - ok, so I can't create a redis client on global level since NIm complains on gc-safety. |
11:18:00 | gokr | Probably because I have threads:on |
11:18:20 | gokr | I end up doing .threadvar. yadda yadda |
11:18:22 | Araq | nimsuggest has --threads:on too |
11:18:33 | Araq | but it doesn't use much of the stdlib I guess |
11:18:49 | Araq | it's a good point, we need to make it the default, at least for testing things |
11:19:40 | gokr | PMunch: Problem is ... the setCallbacks() stuff in the MQTT lib doesn't work. |
11:20:21 | gokr | PMunch: Which is what I have been battling today for several hours. |
11:20:36 | * | endragor quit (Remote host closed the connection) |
11:20:53 | PMunch | Doesn't work? |
11:21:07 | * | endragor joined #nim |
11:21:35 | gokr | Not gc-safe, and then... when I tagged some things as gcsafe - it blew up in callback code - and then I added setupForeignGC - and then it got a bit further, and now blows up and I have no clue. |
11:22:44 | Araq | oh I see |
11:22:56 | Araq | it runs the callbacks on some random thread |
11:23:00 | gokr | yup |
11:23:05 | Araq | Nim has no control over |
11:23:18 | Araq | that's like the worst thing that can be possible done :-) |
11:23:25 | gokr | And it has a context thingy where it has stuffed in the three callback procs - and it tried to call them |
11:24:01 | PMunch | Well, since you're running the MQTT code in it's own thread I guess you could do it this way: https://github.com/barnybug/nim-mqtt/blob/master/examples/sub.nim |
11:24:11 | PMunch | Then you don't need the setupForeignGC stuff |
11:24:34 | gokr | PMunch: Which is exactly what I did - with a 20 ms timeout |
11:24:59 | PMunch | Why such a short timeout? |
11:25:17 | gokr | Well, I do want that thread to also be able to publish? |
11:26:05 | gokr | So I block on that call, then I use tryRecv on the channel (anything I should publish?) then back to that call (anything coming in?) etc |
11:26:39 | PMunch | Aaah, you want it to also publish |
11:26:53 | gokr | To me it seems that... Nim needs a better story on integrating with libraries that use threads. |
11:27:59 | Araq | that's actually covered by my Nim v2 proposals |
11:28:11 | gokr | Right now... I guess channels is the way to go - but ... not sure. |
11:28:48 | gokr | So this mqtt lib, it registers its internal callback procs - fine. And I suppose they should stuff something onto a channel and be gone. |
11:29:30 | gokr | Instead of using this context object with callback procs etc, we can't really call them anyway because we are in a foreign thread, right? |
11:29:49 | gokr | I mean, we could call, but the pain just continues. |
11:32:15 | gokr | This is the trouble area: https://github.com/barnybug/nim-mqtt/blob/master/src/mqtt.nim#L141-L170 |
11:32:17 | * | Vladar quit (Remote host closed the connection) |
11:32:41 | gokr | The context thing on line 160 - I moved that to line 166 and used allocShared0 |
11:33:05 | gokr | Then I threw in setupForeignGC() on line 142 |
11:33:23 | gokr | But... on line 152 - it goes boom anyway. |
11:33:40 | gokr | All looks good until line 152. |
11:36:08 | * | Yardanico quit (Remote host closed the connection) |
11:36:57 | PMunch | Uhm, it looks like that might be a GC issue |
11:38:07 | PMunch | He creates a Context value, but he never does the GC_ref thing |
11:38:21 | gokr | https://github.com/gokr/nim-mqtt |
11:38:28 | gokr | I threw up my hack there |
11:38:55 | PMunch | And he then casts random pointers he gets from the MQTT library to the Context type |
11:39:12 | gokr | Here you can see exactly what I did: https://github.com/gokr/nim-mqtt/commit/224160f2d12d069142f9422eecccc6f1b753dd20 |
11:39:28 | gokr | It blows up right after "All good" :) |
11:39:33 | PMunch | So the MQTT library holds the pointer to the Context, but since Nim doesn't know about it any longer it will garbage collect it and free the memory causing crashes |
11:39:58 | gokr | Mmmm, but check my link above - I used allocShared0 |
11:41:01 | dom96 | mqtt appears to just be a wrapper to a C lib :\ |
11:41:04 | gokr | He held the context in a global. I moved it (gc-safety) and tried allocShared0 instead |
11:41:12 | dom96 | I see a lot of `pointer` which is just messy and asking for trouble. |
11:41:16 | gokr | dom96: It is, it's the PAHO C lib, tried and true. |
11:41:22 | dom96 | Do you need to use MQTT? |
11:41:32 | gokr | Hehe |
11:41:52 | gokr | Well, I am now possibly leaning towards WAMP - but Nim doesn't have that either |
11:42:07 | PMunch | Hmm, yeah in your file it looks like it should work.. |
11:42:22 | gokr | MQTT works very well, we have used VerneMQ in many projects and the js lib is stable and good. |
11:42:34 | gokr | It's king in IoT. |
11:43:00 | gokr | dom96: It's pub/sub you know. |
11:43:19 | gokr | There is a beginning of a Nim mqtt implementation though - but very barebone. |
11:43:27 | dom96 | Write a native pub/sub implementation in Nim? ;) |
11:43:28 | gokr | And to be frank... it's not trivial. |
11:43:44 | gokr | Well, I am trying to make Canoe ... |
11:43:52 | dom96 | yeah, I know. |
11:44:18 | gokr | If any of you would help out - it would change the story of course. It's a really cool project (Raiblocks and Canoe). |
11:44:26 | * | Yardanico joined #nim |
11:44:56 | gokr | We actually got 150 XRB in anonymous donation - that was earlier almost $4500. |
11:45:48 | dom96 | if you're willing, another thing you could try is creating a separate process to handle the MQTT stuff |
11:45:57 | dom96 | I don't know how realistic this is |
11:46:04 | dom96 | you could communicate with it via sockets |
11:46:08 | gokr | dom96: This is the Nim code btw: https://github.com/getcanoe/canoed |
11:46:19 | gokr | Very small so far |
11:47:07 | gokr | Right now it doesn't run though - nim-httpauth doesn't mix well with threads:on |
11:47:20 | gokr | dom96: Yeah. |
11:47:44 | dom96 | so is nim-httpauth the only problem currently? |
11:47:57 | * | Vladar joined #nim |
11:48:07 | gokr | Well... the main problem is the MQTT library that needs threads:on |
11:48:14 | PMunch | I think it's mostly a question about writing a better wrapper for the MQTT library |
11:48:21 | gokr | That causes nim-httpauth to fail - gc-safety issues |
11:49:12 | dom96 | Does MQTT offer no async support? |
11:49:17 | gokr | Sure... cutting out MQTT... but then the question start popping up - why am I just not whipping it up in node? |
11:49:35 | gokr | dom96: It does have an async API - but it doesn't work. |
11:49:46 | PMunch | Not cutting out, just fixing the wrapper |
11:50:04 | gokr | PMunch: I was referring to the "use a socket with another process" |
11:50:14 | PMunch | Oh right |
11:50:35 | gokr | But yes, fixing the wrapper would be nice. But unless you make it use asyncdispatch - it still requires threads:on and still makes nim-httpauth barf. |
11:50:56 | dom96 | if MQTT wrapper has async support then you should definitely try it |
11:50:56 | PMunch | Yeah.. |
11:50:58 | dom96 | I can help |
11:51:04 | dom96 | I need to leave for a lecture now |
11:51:08 | dom96 | brb in like 10 minutes |
11:51:08 | gokr | Cool |
11:51:12 | gokr | Super |
11:51:20 | PMunch | A 10 min lecture` |
11:51:23 | PMunch | ? |
11:51:24 | gokr | Hehe |
11:51:36 | gokr | He is a quick learner |
11:52:29 | gokr | I wonder if Dominik could asyncify that lib. The lib seems kinda well done, apart from this async stuff that ... is half b0rken |
11:53:03 | * | tinAndi joined #nim |
11:53:07 | * | samhain joined #nim |
11:53:56 | gokr | An alternative would be to wrap some WAMP library. Anyone used WAMP? |
11:53:59 | PMunch | Probably. It appears to be written by someone who didn't quite know how Nim works with foreign libs and threads |
11:54:28 | PMunch | "WampServer refers to a software stack for the Microsoft Windows operating system" |
11:54:32 | * | PMunch *shudders* |
11:54:56 | gokr | wamp-proto.org |
11:55:00 | PMunch | But I guess that's not the one you were talking about :P |
11:55:02 | PMunch | Yeah |
11:55:58 | PMunch | Never used it, but it looks interesting |
11:56:12 | gokr | It does have a whole slew of implementations. |
11:56:37 | gokr | Although I doubt it's as mature as MQTT. |
11:58:43 | * | tinAndi quit (Ping timeout: 256 seconds) |
11:58:46 | * | endragor quit (Remote host closed the connection) |
11:59:14 | * | endragor joined #nim |
11:59:19 | * | endragor quit (Remote host closed the connection) |
12:00:25 | PMunch | Probably not |
12:00:32 | PMunch | MQTT has been around for a while |
12:00:50 | enthus1ast | but MQTT is full of dragons |
12:00:58 | * | endragor joined #nim |
12:02:17 | enthus1ast | http://vasters.com/archive/MQTT-An-Implementers-Perspective.html |
12:03:37 | FromGitter | <Bennyelg> When Installing Nim from devel (by git clone) where to clone it and compile it if I'm on mac? what is the acceptable place? (Application dir ?) |
12:05:20 | crem | I believe its better to do with choosenim, it will do everything automatically somehow. choosenim #head |
12:06:09 | FromGitter | <Bennyelg> no, I love to develop from the latest branch, sometimes I'm trying to fix bugs this is how I practice learning the language internals |
12:06:37 | FromGitter | <dom96> gokr: PMunch: heh, that's how long it takes to walk to the lecture :P |
12:06:59 | FromGitter | <dom96> @Bennyelg I have mine in ~/projects/nim |
12:07:17 | FromGitter | <Bennyelg> thanks this is probably what I'll do. |
12:07:21 | FromGitter | <dom96> gokr: in what way does the async API not work? |
12:07:37 | FromGitter | <dom96> isn't Node basically all async? How does it deal with that? |
12:07:59 | gokr | If you look at this link: https://github.com/gokr/nim-mqtt/commit/224160f2d12d069142f9422eecccc6f1b753dd20 |
12:08:23 | gokr | You can see what tweaks I tried to make it work. |
12:08:40 | gokr | The "async" style of that lib is based on using setCallbacks() |
12:08:50 | gokr | There is an example in examples called callbacks.nim |
12:09:12 | FromGitter | <dom96> why are you using threads still then? |
12:09:20 | arnetheduck | if nim was designed today, would it still use exceptions for error handling? |
12:09:45 | gokr | dom96: That's not "Nim async" - it's PAHO C-lib async. |
12:10:03 | gokr | Meaning the C-lib has it's own threads doing stuff |
12:11:35 | FromGitter | <dom96> so it fakes async with threads? lol |
12:11:45 | FromGitter | <dom96> is this the lib? https://github.com/eclipse/paho.mqtt.c |
12:11:51 | * | AndroUser2 joined #nim |
12:11:51 | gokr | Yes |
12:11:57 | * | AndroUser2 quit (Client Quit) |
12:12:09 | gokr | "fakes async" I would say that. |
12:12:22 | gokr | The C lib has both a blocking API and a non blocking one. |
12:12:33 | gokr | It doesn't claim to be async, sorry if I used the wrong term here. |
12:13:07 | gokr | The callback stuff in nim-mqtt relies on the non blocking API in the C lib, and it uses internal threads. |
12:13:21 | FromGitter | <dom96> I see :\ |
12:13:36 | gokr | it would be awesome if we could make this wrapper ... better. |
12:13:45 | FromGitter | <dom96> Then we need to ask Araq how to handle libraries that do this |
12:13:54 | FromGitter | <dom96> presumably the callbacks are called in a separate thread? |
12:13:55 | gokr | But I am also not pretending it's an easy task. |
12:14:04 | gokr | Yes, that's the crux. |
12:14:13 | * | AndroUser9 quit (Ping timeout: 256 seconds) |
12:14:15 | gokr | The C lib calls back in its own foreign thread. |
12:14:55 | gokr | We could probably use some channel(s), but I have no idea how to... not use threads:on. |
12:15:36 | FromGitter | <dom96> To use channels I think you need to enable threads |
12:16:26 | FromGitter | <dom96> I'm sure there are many libraries that behave this way, we need a general way to tackle this |
12:16:30 | FromGitter | <dom96> Araq? Any ideas? |
12:18:48 | FromGitter | <dom96> I don't see a way that this can work without --threads:on though, if this is the issue then there is no way to get around it. |
12:19:04 | FromGitter | <dom96> do your changes to MQTT wrapper work? |
12:19:18 | gokr | My changes... kinda work a bit |
12:20:04 | gokr | It blows up still - and I am not sure why. It blows up here: https://github.com/gokr/nim-mqtt/blob/master/src/mqtt.nim#L155 |
12:22:21 | FromGitter | <dom96> what does it blow up with? |
12:22:41 | gokr | SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
12:23:29 | gokr | The topic etc comes in fine. But at that line, boom. |
12:23:40 | * | xet7 quit (Ping timeout: 260 seconds) |
12:24:20 | FromGitter | <dom96> hrm, maybe https://github.com/gokr/nim-mqtt/blob/master/src/mqtt.nim#L126 this needs {.cdecl.}? |
12:24:55 | gokr | can try |
12:25:13 | FromGitter | <dom96> also https://github.com/gokr/nim-mqtt/blob/master/src/mqtt.nim#L35 |
12:25:16 | FromGitter | <dom96> that looks wrong |
12:26:02 | FromGitter | <dom96> So what about other MQTT-like protocol libraries? Do they offer async? |
12:28:55 | FromGitter | <dom96> WAMP seems to have many implementation which suggests that writing one shouldn't be too difficult :) |
12:30:54 | FromGitter | <dom96> But yeah, I understand that it's extra work. But there is no getting away from it sometimes. If everyone decides at this point to just use Node then we will all be using Node by 2020. :/ |
12:32:43 | * | kunev quit (Ping timeout: 256 seconds) |
12:33:21 | * | gokr quit (Ping timeout: 264 seconds) |
12:33:24 | * | gokr1 joined #nim |
12:33:48 | * | Vladar quit (Remote host closed the connection) |
12:33:56 | gokr1 | dom96: Argh. My machine went thrash-berzerk |
12:34:08 | * | kunev joined #nim |
12:34:34 | FromGitter | <andreaferretti> Stupid question: if the C library does its own things with its own internal threads, why is Nim multithreading (--threads:on) even needed? |
12:34:56 | FromGitter | <andreaferretti> A lot of libraries do that and they work just fine single threaded |
12:35:03 | FromGitter | <andreaferretti> I mean from the Nim point of view |
12:35:29 | FromGitter | <andreaferretti> For instance, all BLAS implementations will use multiple threads to multiply big matrices |
12:35:45 | gokr1 | In this case it was needed to have the blocking calls to the MQTT lib coexist with Jester |
12:35:55 | * | sz0 quit (Quit: Connection closed for inactivity) |
12:35:58 | gokr1 | So I had to make a thread and a channel etc - that talks to the mqtt lib |
12:36:07 | FromGitter | <andreaferretti> ok I see |
12:36:39 | * | xet7 joined #nim |
12:37:36 | FromGitter | <dom96> why do you need a thread? |
12:37:40 | FromGitter | <dom96> You should only need a channel |
12:39:05 | gokr1 | Well ... |
12:41:18 | gokr1 | I tried adding cdecl to ... the callbacks, but nah. |
12:42:00 | gokr1 | And I really am not sure what those callbacks could do anyway - they are in a foreign thread so can't touch anything. |
12:42:17 | gokr1 | So moving to some channel API here is probably what one wants to do |
12:43:32 | gokr1 | Sidenote: setupForeignThreadGC() requires threads:on so... we end up with threads:on anyway. |
12:43:49 | gokr1 | Since I presume those are needed still in the "inner" callback procs that nim-mqtt uses. |
12:46:07 | FromGitter | <dom96> hrm, another issue might be to do with that function. The callbacks are called multiple times, so you'll be setting up the GC multiple times in the same thread, couldn't that cause problems? |
12:47:40 | FromGitter | <dom96> can you use zmq btw? It seems to offer a poll function implying it doesn't use threads for async |
12:48:40 | FromGitter | <dom96> I think it's time we set up a "library hack" |
12:49:08 | gokr1 | zmq... is a totally different beast alltogether |
12:49:15 | FromGitter | <dom96> where we all create wrappers or libraries for various common scenarios that we ensure work |
12:52:20 | FromGitter | <dom96> bbl |
12:54:43 | * | endragor quit (Remote host closed the connection) |
12:55:10 | * | endragor joined #nim |
12:57:26 | * | endragor quit (Remote host closed the connection) |
12:57:55 | * | endragor joined #nim |
13:02:14 | * | Snircle joined #nim |
13:05:02 | * | Yardanico quit (Remote host closed the connection) |
13:06:45 | * | couven92 quit (Quit: Client Disconnecting) |
13:07:52 | * | Yardanico joined #nim |
13:10:58 | * | samhain quit (Ping timeout: 268 seconds) |
13:12:10 | * | Yardanico_ joined #nim |
13:12:36 | * | Yardanico_ quit (Remote host closed the connection) |
13:28:47 | * | endragor quit (Remote host closed the connection) |
13:29:16 | * | endragor joined #nim |
13:34:27 | * | m712 left #nim ("WeeChat 2.0.1") |
13:39:40 | * | marenz_ joined #nim |
13:40:59 | * | endragor quit (Remote host closed the connection) |
13:41:27 | * | endragor joined #nim |
13:43:39 | * | Arrrr quit (Ping timeout: 268 seconds) |
13:58:05 | * | Vladar joined #nim |
14:12:53 | * | dddddd joined #nim |
14:38:05 | Araq | hmm my new newlines fail on Windows |
14:43:46 | * | MJCaley joined #nim |
14:43:58 | gokr1 | dom96: No need to sweat, I jumped ship. Sorry. |
14:49:58 | Araq | gokr1: I'm looking at your code now. Too late? |
14:50:14 | gokr1 | yeah. Although MQTT is nice to get working of course. |
14:50:23 | gokr1 | But I made the jump. |
14:51:21 | Araq | ok, I'll fix c2nim instead then |
14:57:26 | dom96 | :/ |
15:00:06 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
15:01:52 | dom96 | Araq: We need to figure out what to do about this so others don't suffer the same fate. |
15:03:57 | Araq | Nim v2. ;-) |
15:04:24 | PMunch | gokr, what did you jump ship to? Just out of curiosity |
15:05:36 | gokr1 | nodejs |
15:05:56 | * | sz0 joined #nim |
15:05:57 | gokr1 | Here is a basic port of canoed to nodejs: https://github.com/getcanoe/canoed/blob/master/canoed2/canoed2.js |
15:06:10 | federico3 | urgh |
15:06:41 | gokr1 | One can say whatever one wants about nodejs. But "unfortunately" it gets the job done. |
15:07:18 | gokr1 | I don't like js either, but I have come to realize the ... effectiveness of node as a tool. |
15:07:49 | gokr1 | Ok, gotta run |
15:08:06 | gokr1 | Thanks for all the help earlier, sorry I couldn't ... stick to it. |
15:08:32 | Araq | oh btw you could have tried --gc:boehm and --threadanalysis:off |
15:08:32 | Araq | for some reason I keep forgetting these exist :-/ |
15:08:32 | Araq | bye |
15:08:58 | gokr1 | Ah |
15:11:26 | * | c0ntribut0r quit (Quit: Quit) |
15:13:38 | * | gokr1 quit (Ping timeout: 255 seconds) |
15:15:34 | * | xkapastel joined #nim |
15:18:07 | * | endragor quit (Remote host closed the connection) |
15:18:34 | * | endragor joined #nim |
15:19:03 | * | endragor quit (Remote host closed the connection) |
15:20:34 | * | endragor joined #nim |
15:22:32 | FromGitter | <Bennyelg> https://github.com/Bennyelg/lightForum |
15:24:20 | PMunch | Cool! |
15:25:09 | FromGitter | <Bennyelg> There are plenty to do but the basics are already working. ⏎ Im newb to Nim so there are probably plenty of bad implementation |
15:25:22 | FromGitter | <Bennyelg> maybe I'll continue to develop it to practice on nim |
15:25:53 | euantor | looks like you've checked binaries (`server` and `utils`) into Git, I'm guessing you hadn't noticed :) |
15:26:11 | FromGitter | <Bennyelg> yea :| |
15:26:12 | FromGitter | <Bennyelg> hehe |
15:26:43 | euantor | same with `db_migrator` |
15:26:53 | FromGitter | <Bennyelg> same with all |
15:27:09 | FromGitter | <Bennyelg> how do I ignore them on the .git file ? |
15:27:33 | euantor | not very easily unfortunately. You either do it by single file name, or ignore all and exclude `*.nim` |
15:27:33 | FromGitter | <Bennyelg> .gitignore * |
15:28:12 | FromGitter | <Bennyelg> :/ |
15:29:14 | euantor | https://www.irccloud.com/pastebin/dLVtc00E/ |
15:29:29 | FromGitter | <GULPF> https://github.com/nim-lang/Nim/blob/devel/.gitignore |
15:29:40 | euantor | That will kind of work, but you might need to exclude other files like `LICENSE` and `README.md` |
15:30:23 | * | c0ntribut0r joined #nim |
15:31:48 | shashlick | what's the nimble directory structure for a command line tool? it says everything should be in one .nim file |
15:32:06 | shashlick | I have all my code in a "src" directory and specified srcDir = "src" |
15:33:40 | euantor | if you have multiple nim files, it should be `src/[my_module.nim,my_module/utils.nim,my_module/bla.nim]`. Something like: https://github.com/euantorano/serial.nim/tree/master/src |
15:34:27 | shashlick | how do you import those modules? just import module/file? |
15:35:29 | euantor | Yep: https://github.com/euantorano/serial.nim/blob/master/src/serial.nim#L55 |
15:37:12 | PMunch | dom96, is this something that could be included into nim doc? https://github.com/PMunch/combparser/blob/master/nimtorst |
15:37:16 | shashlick | awesome thanks! |
15:41:25 | * | regtools joined #nim |
15:43:36 | * | regtools quit (Client Quit) |
15:43:41 | * | endragor quit (Remote host closed the connection) |
15:43:45 | * | regtools joined #nim |
15:44:08 | * | endragor joined #nim |
15:44:08 | * | endragor quit (Remote host closed the connection) |
15:46:01 | * | endragor joined #nim |
15:46:40 | * | regtools quit (Client Quit) |
15:47:00 | * | regtools joined #nim |
15:47:10 | * | regtools quit (Client Quit) |
15:47:35 | * | regtools joined #nim |
15:52:15 | shashlick | euantor: doesn't quite work - nimble still complains, says my_module folder should actually be my_module_pkg |
15:52:25 | shashlick | and my_module/utils doesn't import |
15:52:53 | * | NimBot joined #nim |
15:53:20 | shashlick | dom96: this is inconsistent with the documentation as well |
15:53:21 | shashlick | https://github.com/nim-lang/nimble#project-structure |
15:54:58 | dom96 | which part? |
15:56:11 | shashlick | i have a binary nimble package - so I have src\qnim.nim, src\qnim\util.nim |
15:56:25 | shashlick | nimble complains that util is in src\qnim\ and not src\qnimpkg |
15:56:44 | shashlick | in either case, I cannot import util with "import qnim/util" |
15:57:43 | dom96 | did you add srcDir = "src" to your .nimble file? |
15:58:30 | shashlick | yes |
15:59:34 | * | endragor quit (Remote host closed the connection) |
16:00:00 | * | endragor joined #nim |
16:00:11 | shashlick | I'm getting it to work by doing "import ./qnim/util" |
16:00:24 | shashlick | but nimble is still upset about src/qnim/ instead of src/qnimpkg |
16:03:01 | shashlick | okay, so final version - src/qnim.nim, src/qnimpkg/util.nim, "import qnimpkg/util" |
16:03:07 | shashlick | close to what's mentioned in the Hybrid section in the docs |
16:03:36 | shashlick | however, if I have src/qnimpkg/util2.nim which wants to import src/qnimpkg/util, I have to do "import ./util" |
16:08:20 | * | miran_ joined #nim |
16:08:44 | FromGitter | <dom96> Oh yes. If you're making a hybrid then you need to make it that way unfortunately |
16:08:56 | shashlick | it |
16:09:01 | shashlick | it's not really a hybrid, it's just a binary |
16:09:40 | FromGitter | <dom96> Then you should skipExt=@["nim"] |
16:12:53 | FromGitter | <dom96> This will become default in the future |
16:13:00 | FromGitter | <dom96> For binaries |
16:13:26 | shashlick | so if I set skipExt, then I can use src/qnim? |
16:15:58 | shashlick | okay, looks like I can do src/qnim if I skipExt |
16:16:19 | shashlick | but for stuff within src/qnim, if there's modules that import each other, I have to use import ./module |
16:16:49 | euantor | the whole `pkg` suffix is completely pointless |
16:17:32 | euantor | As I've said in the past (and keep meaning to make a PR or issue for), binaries shouldn't end up in the `src` folder when doin `nimble build` - either put them in the working directory, or in a `bin`/`outputs` folder |
16:17:52 | euantor | Libraries/binaries/hybrids should all have the same structure |
16:18:28 | * | FromGitter quit (Remote host closed the connection) |
16:19:13 | * | FromGitter joined #nim |
16:20:42 | * | gokr joined #nim |
16:20:57 | * | PMunch quit (Quit: Leaving) |
16:25:10 | * | gokr quit (Ping timeout: 260 seconds) |
16:43:21 | dom96 | euantor: https://github.com/nim-lang/nimble/issues/308 |
16:43:58 | euantor | oh, nice. Hadn't realised there was an issue already :) |
16:44:00 | dom96 | It's not simply a case of changing where the binaries are output. |
16:44:21 | * | MJCaley quit (Quit: MJCaley) |
16:44:55 | dom96 | at least I don't think it is |
16:45:01 | dom96 | we need to discuss the issues in that RFC :) |
16:45:01 | euantor | yeah, there's also the RFC about Nimble package structure that is about a very similar thing |
16:45:14 | dom96 | yeah, and there is a lot of comments there and lack of consensus :) |
16:45:36 | euantor | sounds about right to me |
16:47:26 | euantor | I've opened issues in the past about how I find running `nim c src/app.nim` creates `./src/app` rather than `./app` (like every other tool that I'm aware of) too, but can't remember if I opened that on the Nim or Nimble repository |
16:49:57 | FromGitter | <andreaferretti> -o app |
16:50:04 | FromGitter | <andreaferretti> done :-) |
16:51:43 | euantor | I prefer sane defaults |
16:52:03 | Araq | not using the likely directory name is a sane default |
16:52:21 | dom96 | and `nim doc src/app.nim` will create ./app.html ... |
16:52:38 | Araq | yeah that one is stupid :P |
16:52:54 | euantor | that one is what I'd expect |
16:53:26 | euantor | I personally wouldn't say that `src` is the expected output directory for a binary |
16:53:47 | euantor | normally `src` or `source` directories are for sources, not for binary artifacts |
16:54:07 | euantor | same as I'd expect resources to be in `resource` directories rather than source code directories |
16:54:29 | * | Trustable joined #nim |
16:55:07 | dom96 | Araq: As far as gokr's issue goes, we should fix it before v2 |
16:55:08 | Araq | Nim doesn't read the directory name though |
16:55:25 | dom96 | And we should ask gokr if he will still use Nim which does not offer a GC |
16:55:32 | dom96 | which AFAIK is what v2 will be |
16:55:46 | Araq | which one? "library runs procs on arbitrary threads breaking the GC?" |
16:55:55 | Araq | what's there to fix? |
16:56:25 | dom96 | how can we make it work? |
16:59:11 | planetis[m] | hey the playground is down since yesterday |
16:59:13 | euantor | No, I know Nim doesn't read the directory name (and it shouldn't), but it should trust the programmer to provide a path if they want to write the resulting binary to a path rather than to their current working directory - just like every other tool under the sun does |
16:59:36 | euantor | @planetis[m] https://play.nim-lang.org - seems to be up for me? |
17:00:03 | Araq | so a default that breaks under Unix is a "sane" default? I beg to differ |
17:00:10 | euantor | though compilation seems to be broken |
17:00:29 | euantor | I must be missing something Araq. How does it "break under Unix"? |
17:01:18 | planetis[m] | yeah well code does not compile |
17:01:27 | Araq | foo.nim # main file |
17:01:35 | Araq | foo/ # nim code that foo.nim uses |
17:01:46 | Araq | nim c foo # cannot create binary 'foo' |
17:02:42 | euantor | so you put code under a `src` directory |
17:02:50 | euantor | The current approach also breaks in this scenario |
17:03:15 | Araq | ok, bad example |
17:03:19 | euantor | ;) |
17:03:25 | Araq | nim c foo/foo.nim # breaks |
17:03:47 | euantor | ok, how often do you do that or see that? |
17:03:53 | Araq | this one is common IMHO |
17:04:17 | euantor | I'd say that in that case the programmer should be expected to be smart enough to specify `-o some_bin` |
17:04:40 | euantor | rather than then having `foo/[foo.nim,foo,foo.exe]` |
17:04:49 | Araq | I'd personally just use the current directory and an '.exe' extension |
17:04:57 | dom96 | well... it's more common to have src/foo/, src/foo.nim |
17:05:02 | dom96 | because that's how Nimble works |
17:05:13 | euantor | Of course, if unix was sane enough to have extensions for executables there'd be a lot less headache |
17:05:33 | euantor | Araq: So basically what I'm proposing, with `.exe` added |
17:05:54 | dom96 | so maybe Nim should check whether a dir exists and give the exe a different name |
17:05:57 | Araq | maybe, *shrug* |
17:06:05 | euantor | What I don't expect is for that scenario to result in `foo/foo` or `foo/foo.exe` - I expect an error, or a `foo.exe` in the cwd |
17:06:20 | euantor | dom96: so `foo_1` or something? |
17:06:42 | dom96 | yeah |
17:06:43 | dom96 | bbl |
17:06:47 | euantor | What do other tools like GCC, Go, DMD, etc. do? I'd guess they just shout at the programmer for being stupid |
17:07:17 | Araq | the best thing would be to remove the 'foo' directory and overwrite it with a 'foo' binary. traditional Unix style. "everything is a file" (directories too?) and "trust the programmer" |
17:08:12 | Araq | plus the classic "who would ever want to undo a delete operation" |
17:08:34 | Araq | XD |
17:10:28 | euantor | Shall I open an issue RFC for this then? |
17:10:48 | euantor | though I probably won't have time until tomorrow |
17:10:49 | floppydh | well at least you can actually delete files, which seems to be something that can't reliable be done with windows file locking :) |
17:12:25 | Araq | floppydh: the crucial difference is this one: Everybody already knows Windows is crap. |
17:12:39 | Araq | it's high time people realize Unix is too. |
17:14:12 | Araq | euantor: sure, let's better fix it for 0.18 |
17:14:22 | Araq | which is about "as many breaking changes as possible" |
17:15:42 | * | yglukhov quit (Remote host closed the connection) |
17:16:30 | floppydh | Araq: been "maining" Linux for quite a while now, dabbled in FreeBSD before, BSD people seem to think more highly of their OS, Linux people, who actually have been using Linux for more then a couple of months, and who aren't kids, don't think that much of Linux AFAIS, it's hard to be a fan of anything over time in my experience, for Linux peoples plan9 is their pipedream that magically does everything better, so |
17:16:31 | floppydh | if you want to get truly get Linux peoples, say plan9 is crap :) |
17:16:54 | floppydh | s/get truly get/truly get to/ |
17:22:33 | Araq | I said "Unix" and I meant "Unix", BSD and Linux inherit all of its bullshit |
17:24:39 | Araq | but also improving some things. too bad nobody sees the problems in not being able to blacklist compiled binaries in a gitignore file. |
17:25:34 | * | nsf quit (Quit: WeeChat 2.0.1) |
17:30:46 | * | endragor quit (Remote host closed the connection) |
17:31:17 | * | endragor joined #nim |
17:35:29 | * | floppydh quit (Quit: WeeChat 2.0.1) |
17:35:53 | * | endragor quit (Ping timeout: 256 seconds) |
17:47:43 | * | endragor joined #nim |
17:52:33 | * | endragor quit (Ping timeout: 264 seconds) |
17:52:33 | * | Sargun quit (Ping timeout: 248 seconds) |
17:52:52 | * | Sargun joined #nim |
17:56:52 | FromGitter | <dom96> Araq: so is there no formula that we can use to work with libraries like mqtt? |
17:59:40 | * | c0ntribut0r quit (Ping timeout: 260 seconds) |
18:01:59 | * | c0ntribut0r joined #nim |
18:04:37 | * | yglukhov joined #nim |
18:09:04 | * | yglukhov quit (Ping timeout: 252 seconds) |
18:21:00 | * | c0ntribut0r quit (Read error: Connection reset by peer) |
18:24:52 | * | c0ntribut0r joined #nim |
18:25:22 | * | drs joined #nim |
18:26:26 | drs | is there a way to call into nim from C? I have a large C program that i'd like to re-write into nim, although i need to probably do it a portion at at time. |
18:26:49 | drs | I guess what i'm looking for is to use gcc with nim provided .o files |
18:27:17 | * | yglukhov joined #nim |
18:27:27 | drs | gcc -Wall -O2 -o my_program cobj.o nimobj.o |
18:29:47 | * | yglukhov quit (Read error: Connection reset by peer) |
18:30:23 | * | yglukhov joined #nim |
18:32:05 | * | xet7 quit (Ping timeout: 240 seconds) |
18:44:26 | shashlick | you could do that or make your nim code into a lib and use .exportc. |
18:44:26 | shashlick | https://nim-lang.org/docs/manual.html#foreign-function-interface-exportc-pragma |
18:47:17 | * | xet7 joined #nim |
18:47:34 | * | Jesin joined #nim |
18:54:02 | * | nsf joined #nim |
19:15:47 | drs | i installed nim 17.2, then fetched c2nim, it tells me there is no local packages.json and then it's trying to install compiler@>= 0.16.0 |
19:16:02 | drs | why do that when i already have 17.2 ? |
19:19:17 | * | sz0 quit (Quit: Connection closed for inactivity) |
19:25:15 | * | Yardanico quit (Ping timeout: 256 seconds) |
19:25:38 | FromGitter | <dom96> drs: sadly nimble isn't smart enough to realise that yet. |
19:26:17 | FromGitter | <dom96> Or rather, whatever method you've used to install Nim isn't smart enough to tell nimble about it yet :) |
19:28:00 | FromGitter | <dom96> Now that nimble supports "link files" this should be fairly simple to fix. |
19:29:20 | * | Yardanico joined #nim |
19:30:46 | FromGitter | <Bennyelg> Anyone did success install Jupyter Nim ? |
19:31:03 | FromGitter | <Bennyelg> Im wondering if its worth the try |
19:31:33 | FromGitter | <Bennyelg> Second question: ⏎ How is the most easiest way to debug apps ? |
19:31:57 | * | Yardanico quit (Remote host closed the connection) |
19:32:12 | drs | thanks dom96, I think I can do what c2nim is doing manually for my header file |
19:32:13 | shashlick | is there a simple proc to get all keys of a table into a seq? |
19:36:03 | enthus1ast | toSeq(table.keys) |
19:36:17 | enthus1ast | toSeq is from sequtils |
19:36:45 | shashlick | aah - I was doing table.keys() and it wasn't working |
19:36:54 | enthus1ast | keys is an iterator |
19:37:01 | enthus1ast | so you have to for each over it |
19:37:37 | shashlick | how come you can do "for i in table.keys()" but cannot do the () in toSeq |
19:37:41 | drs | when interfacing with C libraries that return a "char *", is there a way to tell nim that the C function returned data that can be simply freed with a call to free() ? |
19:39:30 | enthus1ast | shashlick: i do not understand. Do you mean why you can't call it as a function? |
19:39:59 | shashlick | kind of |
19:41:43 | enthus1ast | https://nim-lang.org/docs/tables.html#keys.i,Table[A,B] it is not a proc but an iterator |
19:41:51 | shashlick | so I can do "for i in table.keys:" and "for i in table.keys()" - both work |
19:42:03 | FromGitter | <dom96> drs: nope. You have to do it manually right now. |
19:42:59 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a68e1c35a9ebe4f75cd164a] |
19:43:06 | FromGitter | <Bennyelg> Trying to install nimsuggest |
19:43:24 | FromGitter | <Bennyelg> anyone familiar with this? |
19:43:29 | enthus1ast | shashlick: this is a nim feature you can mostly omit the braces |
19:43:30 | drs | dom96 (or anyone) do you have a simple example of nim calling "strdup" and "free" then ? |
19:45:44 | shashlick | enthus1ast: ya but here the braces raise an error - if you do keys() in toSeq, it complains that keys() is unknown |
19:47:57 | miran_ | @Bennyelg = jupyter nim? as in nim kernel for jupyter notebooks? that exists? |
19:54:42 | shashlick | do we have a nim source code tokenizer lib? |
20:06:03 | * | jjido joined #nim |
20:11:36 | FromGitter | <SolitudeSF> uh, just noticed, i created a thread on forum, but i can only see it when im logged in, otherwise it just disappears from list |
20:17:01 | * | xkapastel quit (Quit: Connection closed for inactivity) |
20:18:37 | dom96 | SolitudeSF: all new users are moderated |
20:18:42 | dom96 | the forum needs to make that more clear :) |
20:18:49 | dom96 | I fixed your status |
20:19:27 | FromGitter | <SolitudeSF> ah, ok |
20:23:39 | dom96 | Feel free to bump your post if nobody answers |
20:25:17 | dom96 | I would probably just submit this as issue |
20:25:24 | dom96 | If anything, the error message could be clearer |
20:25:34 | dom96 | Took me a while to realise that 'foldl' introduces a 'b' |
20:25:42 | * | salewski joined #nim |
20:26:42 | * | Jesin quit (Quit: Leaving) |
20:28:10 | salewski | Do we already have a direct rounding proc from float to int, like round(0.9) ==> 1 |
20:33:23 | salewski | round(0.9).int is not that nice, and I assume it generates more code. At least I am using rounding float to int more often than rounding float to float. |
20:36:05 | * | drs left #nim (#nim) |
20:37:09 | * | Jesin joined #nim |
20:39:34 | * | PMunch joined #nim |
20:40:33 | * | Vladar quit (Quit: Leaving) |
20:40:35 | FromGitter | <tim-st> why doesn't this work: `try: ⏎ ⏎ ```return``` ⏎ ⏎ for e in node:` [https://gitter.im/nim-lang/Nim?at=5a68ef4398927d5745304b69] |
20:41:02 | FromGitter | <tim-st> file.nim(16, 12) Error: undeclared identifier: 'node' |
20:41:37 | FromGitter | <tim-st> doesnt the compile knows, that it is always declared? |
20:41:38 | * | jjido quit (Read error: Connection reset by peer) |
20:42:37 | dom96 | Nim's scoping rules are different from python |
20:42:42 | FromGitter | <tim-st> ah, I got it my mistake |
20:42:46 | dom96 | You need to declare this variable outside the 'try' |
20:42:47 | * | ofelas quit (Quit: shutdown -h now) |
20:42:57 | PMunch | Does Python allow that scoping? |
20:43:00 | FromGitter | <tim-st> yes |
20:43:35 | FromGitter | <tim-st> this is of course not a one liner |
20:45:30 | PMunch | That's just confusing.. They are two different blocks |
20:45:52 | FromGitter | <tim-st> ok, wasnt my mistake, I thought first there wasnt an exception. So the compiler doesnt know that this could should always work |
20:46:16 | FromGitter | <nitely> PMunch: try...except does have its own scope in python iirc |
20:46:30 | FromGitter | <nitely> *does not have |
20:46:35 | * | ofelas joined #nim |
20:48:03 | FromGitter | <nitely> that code would not work in python either, but coz if `getNode` raises then `node` is never declared |
20:48:27 | FromGitter | <tim-st> of course getNode raises |
20:48:43 | FromGitter | <tim-st> and the except block returns the proc |
20:48:50 | FromGitter | <tim-st> so why shouldnt this work? |
20:49:49 | FromGitter | <nitely> coz try..except has its own scope in Nim, iirc |
20:50:43 | FromGitter | <nitely> so var/let you declare inside try..except is not visible outside of it. So, can't declare `node` and then use it on the except section |
20:51:25 | FromGitter | <tim-st> I dont use it inside the exception block, wait a second for the code |
20:51:43 | FromGitter | <nitely> you should declare it outside of try..except and then assign to it. But that won't work either in this case, coz of getNode raising |
20:52:07 | FromGitter | <nitely> ah! |
20:52:08 | PMunch | Yeah there are multiple things wrong with that example :P |
20:52:22 | FromGitter | <nitely> well, still, you're tying to use it outside of try..except |
20:53:08 | FromGitter | <nitely> yeah, I missed the return |
20:53:35 | FromGitter | <nitely> declaring `node` outside of try..except should fix it then |
20:53:41 | FromGitter | <tim-st> what is the syntax here for multiline code? |
20:53:57 | FromGitter | <tim-st> yes, exactly, but this isnt necessary in theory |
20:54:23 | FromGitter | <nitely> it is... try..except has its own scope, same for `if..else` |
20:54:55 | dom96 | I added a new label to the GitHub repo called "User story", for real-life problems faced by Nim developers that I think we need to resolve. First issue for that label is the problems that gokr faced: https://github.com/nim-lang/Nim/issues/7134 |
20:56:09 | * | Trustable quit (Remote host closed the connection) |
20:56:32 | FromGitter | <tim-st> It is necessary by the definition of nims scope, but it wouldnt be necessary for my code to run correct => it's a pain for the developer; I woulnt ever use this way in python |
20:57:33 | subsetpark | I think the hygiene gained by the stricter scope is very welcome |
20:57:41 | subsetpark | Nim in general is much safer than Python |
20:58:20 | FromGitter | <tim-st> And that's good. But this time both ways have the same safety. This was the reason I wrote it.. |
20:58:47 | FromGitter | <tim-st> Of course if someone doesnt return, both declarations should be needed |
20:59:43 | * | salewski quit (Quit: WeeChat 1.9.1) |
21:02:16 | FromGitter | <nitely> I prefer Nim's way and I'd prefer it to be consistent instead of full of special cases I have to remember |
21:04:00 | FromGitter | <tim-st> the problem here was, that I would to initialize my object to be iterable or do additionally do a check if it's not nil, but when this is needed I have to go this way.. |
21:05:32 | FromGitter | <nitely> well, the nil check can be omitted since there's a return on except :P |
21:07:19 | FromGitter | <tim-st> ok, thats true |
21:07:31 | FromGitter | <nitely> I don't think the initialization is required. just do `var node: Node` |
21:07:53 | FromGitter | <tim-st> yes, i have it this way |
21:08:19 | FromGitter | <tim-st> it works now, thanks! |
21:09:46 | FromGitter | <nitely> great :) |
21:11:05 | * | Snircle joined #nim |
21:13:09 | * | saml_ joined #nim |
21:19:21 | * | miran_ quit (Quit: Konversation terminated!) |
21:23:50 | * | saml_ quit (Ping timeout: 260 seconds) |
21:25:04 | * | nsf quit (Quit: WeeChat 2.0.1) |
21:28:24 | * | PMunch quit (Quit: leaving) |
21:29:14 | FromGitter | <nitely> @dom96 I just read the issue. I think the "side note" is the way to go. httpauth must be fixed to work with `threads:on`, though |
21:30:29 | dom96 | yep |
21:31:29 | FromGitter | <nitely> and I wonder if it's possible to use a Lock and a seq or queue and add whatever data is passed through callback to it. Then have an async proc awaiting on that seq. Dunno if it's even possible XD |
21:35:41 | FromGitter | <nitely> nevermind, cheatfate just posted what I was thinking |
21:35:43 | * | saml_ joined #nim |
21:37:29 | * | xkapastel joined #nim |
21:38:11 | FromGitter | <mratsim> !eval echo “test" |
21:38:11 | NimBot | Compile failed: <no output> |
21:38:38 | FromGitter | <mratsim> > > Playground is broken |
21:43:59 | * | gangstacat quit (Ping timeout: 276 seconds) |
21:49:26 | * | gokr joined #nim |
21:51:38 | * | c0ntribut0r quit (Ping timeout: 252 seconds) |
21:59:09 | dom96 | yeah :\ |
21:59:35 | dom96 | @zacharycarter ^ |
22:04:17 | * | saml_ quit (Remote host closed the connection) |
22:09:59 | * | vlad1777d joined #nim |
22:14:48 | * | gangstacat joined #nim |
22:22:49 | shashlick | dom96: this is a valid issue still - https://forum.nim-lang.org/t/1731 |
22:29:17 | * | BitPuffin quit (Remote host closed the connection) |
22:32:52 | dom96 | shashlick: PR? :) |
22:33:10 | shashlick | 🙂will do |
22:39:36 | shashlick | my nim quick editor is coming up quite well, any beta testers? |
22:43:09 | dom96 | sure, send a link :) |
22:50:12 | * | yglukhov quit (Remote host closed the connection) |
22:50:39 | shashlick | dom96: https://www.dropbox.com/s/ndx7caouppckzb8/qnim.zip?dl=0 |
22:51:24 | shashlick | need to get it onto github soon |
22:53:27 | dom96 | nice |
22:53:33 | dom96 | If I press space, the line increments :) |
22:53:39 | dom96 | seems like a bug |
22:54:01 | dom96 | the interface is a little confusing |
22:54:09 | shashlick | what's your terminal? |
22:54:26 | dom96 | macOS terminal |
22:54:38 | shashlick | aah, I've not tested this on mac at all |
22:54:50 | shashlick | can you send me your map |
22:55:11 | shashlick | nimble buildmap && ./buildmap |
22:55:26 | shashlick | it's a lot of keys :D |
22:59:15 | dom96 | lol? |
22:59:27 | dom96 | Does it want me to enter every key combination in the world? |
22:59:31 | dom96 | also... Enter CTRL_C: |
22:59:39 | dom96 | yep, that terminates the app |
23:00:11 | shashlick | ya I need to remove that, CTRL-Q, S and Z |
23:00:26 | shashlick | or add a sig handler |
23:00:28 | shashlick | which I added to the editor |
23:00:46 | shashlick | never mind, I'll borrow a mac and try it out |
23:02:32 | dom96 | https://gist.github.com/dom96/413d79ea1485a5a8024a7e0a1fe95c21 |
23:03:00 | dom96 | I pressed ESC for the ones that didn't work |
23:05:34 | shashlick | most of the stuff lines up with xterm, but I'm wondering how you are getting newlines for space |
23:06:26 | * | MJCaley joined #nim |
23:17:53 | dom96 | it does add a space when I press the spacebar |
23:18:04 | dom96 | it increments the line number on the current line |
23:18:12 | dom96 | yielding duplicate line numbers |
23:24:00 | * | arnetheduck quit (Ping timeout: 260 seconds) |
23:43:58 | * | MJCaley quit (Quit: MJCaley) |
23:53:47 | * | MJCaley joined #nim |