00:00:49 | FromGitter | <zacharycarter> hrm I'm binding to the C API, so the C++ docs may be off |
00:01:23 | FromGitter | <zacharycarter> `````` |
00:02:13 | FromGitter | <zacharycarter> terminal_close() shouldn't return anything it should just be a void function |
00:02:25 | FromGitter | <zacharycarter> if you're not opening the terminal first, that's the only reason I can think it'd throw an error |
00:03:20 | LyndsySimon | I've beat at it enough; one sec I'll push my current state. |
00:03:48 | FromGitter | <zacharycarter> cool |
00:04:50 | LyndsySimon | Error message: roguelike.nim(7, 25) Error: expression 'terminal_refresh()' has no type (or is ambiguous) |
00:05:06 | LyndsySimon | code: https://gitlab.com/lyndsysimon/roguelike-nim/blob/blt/src/roguelike.nim |
00:06:11 | FromGitter | <zacharycarter> ah okay so these are compiler errors |
00:06:17 | FromGitter | <zacharycarter> one sec I'll set you up with an example |
00:06:29 | LyndsySimon | Thanks :) |
00:06:48 | LyndsySimon | I get the difference between compile-time and run-time errors. I'll be more specific when discussing it in the future. |
00:08:26 | FromGitter | <zacharycarter> np - I think the reason you were getting it is because you put discard in front of terminal_refresh() which doesn't return anything |
00:09:18 | LyndsySimon | Looks that way - back to the malloc error that I believe is unrelated. |
00:09:28 | LyndsySimon | Ah, OK. So you don't have to discard a void. |
00:09:46 | LyndsySimon | Also, that means that void and null are different things... |
00:09:52 | FromGitter | <zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5954455076a757f808b7cd18] |
00:09:57 | FromGitter | <zacharycarter> yes they are |
00:11:05 | LyndsySimon | Awesome! That runs and terminates without throwing errors |
00:11:46 | LyndsySimon | FWIW, while I'm still having trouble with the errors, I suspect that's because I just don't have the context yet to know what they mean. |
00:11:57 | LyndsySimon | I'm pretty impressed with the error output. |
00:14:57 | FromGitter | <zacharycarter> yeah it takes time getting used to the compiler, it can be extremely cryptic at times |
00:15:39 | FromGitter | <zacharycarter> most of the time though you get one of several types of warnings / errors |
00:16:17 | FromGitter | <zacharycarter> best thing to do is just ask until you get familiar with them |
00:22:07 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
00:24:05 | * | captainkraft quit (Ping timeout: 240 seconds) |
00:26:29 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
00:26:39 | * | captainkraft joined #nim |
00:27:05 | libman | fsmonitor is being discussed at https://www.reddit.com/r/programming/comments/6jyk34/nim_intro_talk_a_young_systems_programming/dji6ase/ - "Linux only"? |
00:27:24 | libman | Links from https://nim-lang.org/docs/fsmonitor.html to github 404 |
00:31:09 | * | yaiyan_ is now known as Ieuan |
00:36:52 | * | Jesin joined #nim |
00:43:51 | * | bjz joined #nim |
01:00:20 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
01:21:45 | * | NotSpooky joined #nim |
01:28:45 | shmup | If I have an object with a foo: proc() property, is there any special pragma I have to do so that I can call said proc? |
01:28:50 | shmup | I may have worded that very poorly |
01:29:42 | shmup | https://gist.github.com/shmup/6d7971fd78933954be5fb0ec4c87f46f |
01:51:30 | * | chemist69 quit (Ping timeout: 240 seconds) |
01:59:58 | * | NotSpooky_ joined #nim |
02:03:16 | * | NotSpooky quit (Ping timeout: 276 seconds) |
02:05:23 | chrisheller | shmup: that looks OK. |
02:05:43 | * | chemist69 joined #nim |
02:05:47 | chrisheller | How are you populating ''callback'' |
02:07:51 | LyndsySimon | `echo 5 / 2` prints "2.5". How do I do integer division? |
02:07:59 | LyndsySimon | `echo 5 /% 2`? |
02:13:49 | LyndsySimon | OK, so that works. My next question is how do I get the result of that into a cint so I can pass it to terminal_print? :) |
02:15:37 | chrisheller | let myval = 5 /% 2 |
02:15:40 | chrisheller | myval.cint |
02:17:13 | LyndsySimon | Ahhhh |
02:17:19 | LyndsySimon | I should have tried that ;) |
02:19:50 | aerx | echo -5 /% 2 prints 9223372036854775805 |
02:19:53 | aerx | is that a bug? |
02:19:58 | * | NotSpooky__ joined #nim |
02:20:30 | LyndsySimon | aerx: I don't think so. `/%` assume unsigned ints as input. |
02:20:52 | LyndsySimon | aerx: I'll bet -5.uint will return a big number :) |
02:21:27 | aerx | alright |
02:22:28 | * | NotSpooky_ quit (Ping timeout: 255 seconds) |
02:23:51 | aerx | just tested it, but that conversion doesn't seem to be allowed |
02:24:09 | LyndsySimon | Hmmm. then maybe it should throw an error of some kind. |
02:24:17 | LyndsySimon | I don't have enough experience yet to say. |
02:29:35 | aerx | echo $((-5).uint) # Error: cannot convert -5 to uint64 |
02:29:37 | aerx | echo $((-5).uint64) # 18446744073709551611 |
02:30:29 | aerx | weird |
02:32:47 | shmup | chrisheller: i'm probably not thinking correctly about what's really going on here. a.nim has a reset() function that does some stuff. b.nim has fire(b: Button), calling the b.callback() |
02:34:03 | LyndsySimon | Can I get a review and some suggestions for this proc? https://gitlab.com/lyndsysimon/roguelike-nim/blob/blt/src/ui.nim |
02:34:28 | LyndsySimon | I'm just looking to see if it's idiomatic. I'm building one step at a time, so it's not representative of the finished product :) |
02:39:12 | * | pilne quit (Quit: Quitting!) |
02:39:34 | shmup | ah hah, figured it out chrisheller. |
02:46:33 | aerx | LyndsySimon: you could use ..< to avoid having to write the "- 1" |
02:51:02 | chrisheller | LyndsySimon: x and y will be automatically initialized to 0 |
02:55:44 | LyndsySimon | aerx: Awesome, thank you! That's handy. |
02:57:22 | LyndsySimon | chrisheller: I didn't think about that, cool. That lets me remove a logical branch. |
03:03:33 | FromGitter | <girvo> @zacharycarter Thats a shame! I'm having a lot of fun with Frag at the moment :) |
03:06:46 | FromGitter | <girvo> I'm about to get given a crazy high-end POWER8 server from IBM for a client project, and I'm going to be having some fun getting Nim up and running on it :) |
03:12:57 | * | CcxWrk quit (Ping timeout: 240 seconds) |
03:13:08 | chrisheller | girvo: would be interested in hearing how that goes. |
03:14:26 | FromGitter | <girvo> chrisheller: For sure, I'll be writing up some documents on the experience, so I'll definitely see if I can get them published online |
03:14:43 | FromGitter | <girvo> Looking forward to seeing how I can take advantage of some of the crazy instructions and hardware ;) |
03:16:05 | * | CcxWrk joined #nim |
03:17:57 | * | NotSpooky__ quit (Quit: Leaving) |
03:24:04 | * | yglukhov joined #nim |
03:29:04 | * | yglukhov quit (Ping timeout: 276 seconds) |
03:44:40 | LyndsySimon | Well... I'm officially addicted. I just spent six hours hacking in Nim, after having spent eight hours writing Ruby at work. |
03:48:13 | * | arecacea1 quit (Remote host closed the connection) |
03:48:46 | * | arecacea1 joined #nim |
04:18:32 | libman | The word "addicted" has negative connotations. The word "love" has positive connotations. They mean the exact same thing. |
04:56:27 | * | ftsf joined #nim |
04:56:56 | shashlick | after doing a readFile(), do you need to do anything special for the memory to get collected? secureHashFile() does it internally and the memory isn't getting released |
05:03:27 | shashlick | I tried forcing a GC collection with GC_fullCollect() but it isn't releasing the memory |
05:05:36 | * | user0 quit (Remote host closed the connection) |
05:28:19 | * | Vladar joined #nim |
05:58:09 | * | nsf joined #nim |
06:26:49 | * | tankfeeder joined #nim |
06:45:46 | * | yglukhov joined #nim |
06:46:25 | * | yglukhov quit (Remote host closed the connection) |
06:46:41 | * | yglukhov joined #nim |
07:05:30 | Araq | shashlick: stale references on the stack keep things alive but not for long. the GC will collect it. |
07:06:46 | * | Arrrr joined #nim |
07:06:46 | * | Arrrr quit (Changing host) |
07:06:46 | * | Arrrr joined #nim |
07:37:12 | * | v17d joined #nim |
08:20:43 | * | rokups joined #nim |
08:30:03 | * | Vladar quit (Remote host closed the connection) |
08:33:33 | * | xet7 joined #nim |
08:51:03 | * | bjz joined #nim |
09:17:06 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
09:21:21 | * | bjz joined #nim |
09:24:28 | * | sz0 joined #nim |
09:28:48 | * | aerx quit (Quit: WeeChat 1.9) |
09:33:00 | * | Vladar joined #nim |
10:09:43 | * | dom96|w joined #nim |
10:10:16 | * | PMunch joined #nim |
10:11:26 | * | libman quit (Quit: Connection closed for inactivity) |
10:16:51 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
10:17:02 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
10:22:45 | PMunch | Nikky, how's your C porting going? |
10:28:22 | PMunch | Huh, didn't know you could import like this: import snake/[game, keyboard, touch] |
10:28:54 | Araq | PMunch: that's new'ish |
10:29:12 | PMunch | Ah okay, just looking at doms snake game :) |
10:30:17 | yglukhov | Araq: btw, i think we should complete this bracket import functionality to allow nesting and so on. |
10:30:54 | yglukhov | import snake/[game / [bla, blabla], keyboard / blablabla, touch] |
10:34:34 | Araq | meh ok |
10:35:49 | PMunch | That would be neat |
10:36:39 | * | dom96|w joined #nim |
10:37:32 | FromGitter | <zacharycarter> @girvo I'm currently working on a new project, I could always resume frag, but I'm hoping this will serve as a replacement for it |
10:38:44 | FromGitter | <zacharycarter> I like the block import - the nesting I'm not sure if I'd ever use it and it looks horrendous / confusing but I guess if it's wanted |
10:54:41 | * | xet7 quit (Quit: Leaving) |
10:54:45 | PMunch | zacharycarter a new frag? |
10:58:34 | FromGitter | <Varriount> I don't like the idea of all that nesting |
10:59:14 | yglukhov | Varriount: why not? |
10:59:40 | FromGitter | <Varriount> It's confusing to read. |
11:01:45 | * | vivus joined #nim |
11:01:51 | yglukhov | Varriount: it might be when a lot of nested stuff is written in a single line. breaking [] to multiple lines will read more naturally |
11:03:10 | yglukhov | but that's basiacally how you could define a e.g. json literal: %*{ "val": { "val": 1, "val2": 2 }, "val2": 2 } |
11:04:21 | yglukhov | your choice to keep your code readable or not |
11:05:18 | FromGitter | <zacharycarter> PMunch: yeah, although I'm making 3d a first class citizen this time around and not an after thought |
11:05:51 | PMunch | Aah, that's probably a good idea |
11:11:46 | * | yglukhov quit (Remote host closed the connection) |
11:17:03 | * | yglukhov joined #nim |
11:21:04 | * | enthus1ast quit (Ping timeout: 260 seconds) |
11:21:18 | * | yglukhov quit (Remote host closed the connection) |
11:21:49 | * | yglukhov joined #nim |
11:23:03 | * | NimBot joined #nim |
11:24:53 | Nikky | PMunch: not very well.. it seemed to be ok but it was then failing as if the .h file does not fit on the library |
11:25:12 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
11:25:23 | PMunch | Hmm, maybe a bad mapping? What was the error? |
11:25:41 | Nikky | iirc just failed to import |
11:25:56 | Nikky | went to bed after that.. too much frustration |
11:26:11 | * | arnetheduck joined #nim |
11:26:48 | Nikky | could not import: session_create |
11:28:27 | Araq | Nikky: used #cdecl ? |
11:28:45 | Nikky | iirc i did |
11:29:41 | Nikky | not sure though.. might as well start from scratch though |
11:38:21 | PMunch | If it wasn't for the fact that I really should be working on other stuff I would love to help you more.. |
11:39:02 | * | bjz joined #nim |
11:45:26 | * | yglukhov quit (Remote host closed the connection) |
11:46:19 | * | Arrrr quit (Ping timeout: 268 seconds) |
11:47:55 | Nikky | i think i see where i made a mistake |
11:48:09 | Nikky | libtorrent itself is written in cpp |
11:49:33 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
11:50:20 | Nikky | and in the bindings folder is a libtorrent.c and a library.cpp which binds those few functions to the cpp calls.. so i need to convert that one.. or just look into converting the .hpp files in include.. although they are rather difficult to parse for both cppp and c2nim apparently.. fun |
11:55:33 | PMunch | Normally you would pass the .h header file to c2nim |
11:56:32 | Nikky | which converts it fine but the .h file is fo a cpp file .. which i need to include as well somehow ? i do not get this.. its a mess |
11:56:56 | Nikky | i might as well look into converting the original .hpp includes |
11:58:01 | PMunch | Well yes, the .cpp file is linked during the build step |
11:58:10 | PMunch | And you probably want nim cpp instead of nim c |
11:58:13 | * | yglukhov joined #nim |
11:59:07 | Nikky | so i inlcude the cpp file instead of trying to convert it ? |
12:00:22 | PMunch | Wait, which .cpp file? |
12:00:27 | * | dom96|w joined #nim |
12:00:30 | Nikky | library.cpp |
12:00:40 | PMunch | Yeah, that is just included |
12:00:48 | Nikky | which is the file corresponding to libtorrent.h as far as i can see |
12:01:19 | PMunch | The way it works is that c2nim creates the nim code to call the functions defined in library.h. Then you write your nim code which uses these functions, and during build link in the library.cpp file. |
12:02:40 | * | Snircle joined #nim |
12:02:49 | PMunch | Ah you're trying to use the C bindings? |
12:03:00 | PMunch | You would probably be better off using the C++ library directly |
12:03:19 | Nikky | i assumed so but they do not convert without issues |
12:04:15 | Nikky | well i can try to.. write a cppp script to preprocess and then run c2nim on them or so |
12:04:46 | PMunch | Hmm |
12:05:51 | PMunch | Hold on a sec, I'll try something |
12:07:57 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
12:13:41 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
12:14:15 | * | Arrrr joined #nim |
12:14:15 | * | Arrrr quit (Changing host) |
12:14:15 | * | Arrrr joined #nim |
12:19:39 | * | dom96|w joined #nim |
12:20:17 | * | Snircle joined #nim |
12:27:07 | * | Snircle_ joined #nim |
12:29:13 | * | Snircle quit (Ping timeout: 276 seconds) |
12:30:18 | PMunch | Hmm Nikky, are you able to build a running version of simple_client.c? |
12:31:37 | Nikky | it compiles.. it doesn ot run as it fails to include / import the libtorrent functions |
12:31:47 | Nikky | ported it by hand |
12:32:16 | Nikky | tons of cint() and cstring() wrappers required.. would not use that if i had a choice though |
12:35:01 | Nikky | but it seems like c2nim will not be easy to use on the libtorrent .hpp files i see errors about templates and stuff |
12:35:05 | * | Snircle joined #nim |
12:36:04 | * | Snircle_ quit (Ping timeout: 246 seconds) |
12:37:58 | * | Arrrr quit (Read error: Connection reset by peer) |
12:52:16 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
12:53:46 | * | dom96|w joined #nim |
13:06:56 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
13:12:09 | * | bjz joined #nim |
13:15:44 | FromGitter | <ephja> you could do things like defining `or` for enums that represent bit flags |
13:16:29 | Nikky | i would look into that after it runs.. but so far i got nothing to work at all |
13:16:51 | Nikky | at least noting involving c2nim, headers etc |
13:17:29 | * | PMunch quit (Ping timeout: 246 seconds) |
13:26:15 | * | PMunch joined #nim |
13:30:57 | * | arnetheduck quit (Ping timeout: 240 seconds) |
13:35:51 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
13:36:31 | * | Snircle joined #nim |
13:37:57 | * | bjz_ joined #nim |
13:38:46 | * | bjz quit (Ping timeout: 276 seconds) |
13:43:40 | * | arnetheduck joined #nim |
13:51:59 | * | arnetheduck quit (Remote host closed the connection) |
13:53:08 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
13:53:39 | FromGitter | <Varriount> Nikky: is your code up on github? I can try troubleshooting |
13:56:19 | * | SusWombat quit (Ping timeout: 276 seconds) |
14:11:48 | * | bjz joined #nim |
14:12:22 | * | bjz_ quit (Ping timeout: 240 seconds) |
14:13:32 | * | nsf quit (Quit: WeeChat 1.7.1) |
14:16:21 | * | couven92 joined #nim |
14:19:00 | * | dom96|w joined #nim |
14:21:54 | * | tankfeeder quit (Quit: Leaving) |
14:24:05 | * | abeaumont quit (Ping timeout: 240 seconds) |
14:24:11 | * | federico3 quit (Ping timeout: 268 seconds) |
14:24:35 | * | SunDwarf quit (Ping timeout: 240 seconds) |
14:24:41 | * | federico3 joined #nim |
14:27:17 | * | SunDwarf joined #nim |
14:33:43 | FromGitter | <ephja> "nimble install foo" from the nim root: "Error: unhandled exception: Cannot change root of path: Path does not begin with original root. [ValueError]" 路 |
14:34:21 | * | enthus1ast joined #nim |
14:40:31 | Nikky | @Varriount it is not on github yet |
14:49:04 | PMunch | Hmm, another fun project for the ever growing TODO list: https://github.com/screenfreeze/deskcon-desktop |
14:49:16 | PMunch | Create something like that in Nim |
14:49:28 | * | dexterk_ joined #nim |
14:49:38 | PMunch | But I'm thinking only DBus and then have a completely separate GUI |
14:50:55 | * | dexterk quit (Ping timeout: 276 seconds) |
14:51:16 | FromGitter | <barcharcraz> I'm having some boot problems when trying to boot using msvc |
14:52:27 | FromGitter | <barcharcraz> msgs.nim(602, 32) Error: ambiguous call; both tables. (t: var Table[[].A, [].B], key: A) and tables. (t: Table[[].A, [ ⏎ ].B], key: A) match for: (Table[system.string, system.int32], string) ⏎ FAILURE |
14:52:37 | FromGitter | <barcharcraz> this is on iteration 2 |
14:52:38 | * | s joined #nim |
14:52:48 | FromGitter | <barcharcraz> it boots fine with gcc 7.1 (mingw) |
14:53:02 | * | s is now known as Guest44275 |
14:53:50 | * | yglukhov quit (Remote host closed the connection) |
14:54:22 | FromGitter | <barcharcraz> Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64 |
14:54:42 | Araq | barcharcraz: funny thing. now we need to figure out how MSVC miscompiles Nim |
14:55:03 | FromGitter | <ephja> hf |
14:55:06 | FromGitter | <barcharcraz> OK so it's unknown |
14:55:10 | FromGitter | <barcharcraz> shall I bisect it |
14:55:33 | FromGitter | <barcharcraz> if so what's a good old compiler to use |
14:55:40 | FromGitter | <barcharcraz> old nim version that is |
14:55:52 | FromGitter | <barcharcraz> since the new ones can't always compile the old ones |
14:57:49 | * | yglukhov joined #nim |
14:58:26 | dom96|w | ephja: bug report plz |
14:58:51 | * | yglukhov quit (Read error: Connection reset by peer) |
14:58:59 | * | Amun_Ra quit (Quit: WeeChat 1.6) |
14:59:09 | * | yglukhov joined #nim |
14:59:51 | * | Amun_Ra joined #nim |
15:00:01 | Araq | barcharcraz: I don't believe in bisecting :-) |
15:00:13 | FromGitter | <barcharcraz> lol wut |
15:00:20 | * | rokups quit (Quit: Connection closed for inactivity) |
15:00:38 | Araq | but 0.16 can compile 0.17 |
15:00:49 | Araq | and every interim step, I think. |
15:02:48 | FromGitter | <barcharcraz> and it can compile it using msvc as well |
15:03:55 | * | yglukhov quit (Ping timeout: 276 seconds) |
15:05:36 | FromGitter | <barcharcraz> is there a way to get koch to boot but output to a temp exe. I know about temp but it seems to compile in one pass |
15:08:39 | FromGitter | <barcharcraz> meh I'll just make a copy of 0.16.0 |
15:09:18 | FromGitter | <barcharcraz> btw why don't be believe in bisecting |
15:10:23 | * | Guest44275 quit (Quit: Bye) |
15:12:10 | FromGitter | <barcharcraz> 13701c09579447d3c54f6a1e27ab24b89b11b9e9 |
15:12:15 | FromGitter | <barcharcraz> that's the bad commit |
15:12:39 | dom96|w | That's like not believing in gravity :P |
15:14:10 | * | SusWombat joined #nim |
15:14:12 | Araq | so if that's the bad commit, how come GCC and clang are not affected? |
15:14:36 | * | SusWombat quit (Remote host closed the connection) |
15:15:03 | * | SusWombat joined #nim |
15:15:49 | Araq | this is why I don't believe in bisect btw, it doesn't help to find the reason of a bug, it only finds a random commit that seems to have caused the problem |
15:16:10 | FromGitter | <barcharcraz> it's a good start |
15:16:32 | PMunch | Well it finds the first version your code stopped working in. So something in that last commit broke something |
15:16:54 | Araq | if you have a corruption good luck finding it with "bisect", chances are, some commit works, some doesn't and the root cause is somewhere else. |
15:17:55 | Araq | the commit that works might just happen to work. because that's the nature of a corruption. |
15:18:42 | Araq | bisect is harmful. :P |
15:18:56 | FromGitter | <barcharcraz> well codegen obviously changed |
15:19:28 | Araq | it can give you the totally wrong ideas. |
15:19:52 | Araq | it's not a "good start", it can confuse you moreso than not using it at all. |
15:19:57 | PMunch | Well that's true. But it can also allow you to find that one thing that changed |
15:26:09 | Nikky | so this a error i have never seen before in c2nim https://github.com/NikkyAI/nim-libtorrent/blob/master/convert.log#L16 |
15:26:36 | Nikky | seems like it cannot handle those templates very well or so |
15:27:00 | * | kunev quit (Quit: е те!) |
15:28:06 | FromGitter | <Varriount> Nikky: Why are you trying to wrap the C++ API when there are C bindings: https://github.com/arvidn/libtorrent/tree/master/bindings/c ? |
15:28:41 | PMunch | Varriount, he tried that first with little luck.. |
15:29:02 | Nikky | i tried the C bindings.. well i think i tried could get as far as compiling but it did not load the .so correctly |
15:30:08 | FromGitter | <Varriount> Nikky: What's the .so name? |
15:30:26 | Nikky | libtorrent-rasterbar.so |
15:31:40 | * | kunev joined #nim |
15:34:42 | * | Trustable joined #nim |
15:41:16 | Nikky | so i have these files.. https://github.com/NikkyAI/nim-libtorrent/tree/master/test_client |
15:42:10 | Nikky | how do i compile these .nim files with the library.cpp ? |
15:44:09 | * | sz0 quit (Quit: Connection closed for inactivity) |
15:44:51 | FromGitter | <Varriount> Nikky: Tada - https://gist.github.com/Varriount/67c23e839851474daa6ad28f8fa4fd10 |
15:45:21 | FromGitter | <Varriount> That will work on Mac, you'll have to tinker around with the libTorrentDllName to find the right pattern |
15:46:17 | FromGitter | <Varriount> Hm, wait a moment |
15:46:29 | Nikky | yeah well that far i was as well i think but this did not link |
15:47:06 | Nikky | see https://github.com/NikkyAI/nim-libtorrent/blob/master/test_client/libtorrent.nim |
15:47:14 | Nikky | i just have kept the comments in i guess |
15:47:24 | Nikky | could get rid of them.. |
15:47:59 | Nikky | but the corresponding file seems to be the library.cpp and not the dynlib/dll/so file |
15:47:59 | * | yglukhov joined #nim |
15:48:12 | FromGitter | <Varriount> Nikky: It appears that (my) libtorrent dll doesn't export any of those symbols. |
15:48:17 | Nikky | not entirely sure how that is supposed to work there |
15:48:37 | Nikky | https://github.com/NikkyAI/nim-libtorrent/blob/master/test_client/library.cpp |
15:48:56 | Nikky | this file is the other one that is in the c bindings folder.. |
15:48:58 | FromGitter | <Varriount> Nikky: It appears that this file must be included: https://github.com/arvidn/libtorrent/blob/master/bindings/c/library.cpp |
15:49:12 | Nikky | ok well that far i am as well but how ? |
15:49:36 | Nikky | how do i compile the libtorrent.nim with library.cpp ? |
15:49:47 | Nikky | or do i have to convert librarycpp ? |
15:50:49 | FromGitter | <Varriount> Gah. f-ing C++ |
15:50:52 | Nikky | for which i would need to figure out some boost related things and need to link against all the hpp files.. seems not the way to go |
15:51:41 | Nikky | trying my best not to have to use cpp or c.. and it seems i am getting nowhere :/ |
15:52:00 | FromGitter | <Varriount> Nikky: One moment |
15:52:14 | Nikky | i have all the time.. take two moments |
15:52:40 | * | yglukhov quit (Ping timeout: 276 seconds) |
15:56:38 | FromGitter | <Varriount> Nikky: What I would do is use the compile pragma (https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compile-pragma) to compile that library.cpp file |
15:57:03 | FromGitter | <Varriount> Or at least, that's part of the solution |
15:57:24 | * | kunev quit (Quit: е те!) |
15:58:30 | FromGitter | <Varriount> Perhaps you could use this instead: https://github.com/willemt/yabtorrent ? |
15:58:43 | Nikky | so i add the compile program in libtorrent.nim and it might work ? but then it tries to compile and library.cpp depends on a whole bunch of boost and libtorrent headers |
15:59:12 | FromGitter | <Varriount> Nikky: Unfortunately, that's what C++ requires. |
16:00:13 | FromGitter | <Varriount> Instead of adding the C interface to the libtorrent-rasterbar dll, the developers decided to write a separate 'mini-library' that includes the libtorrent source code. |
16:00:22 | FromGitter | <Varriount> :/ |
16:01:35 | Nikky | well the libtorrent hpp files are not going to be any help.. |
16:01:57 | Nikky | and i only tried libtorrent because i thought i might have faster success than with ffmpeg.. hahaha |
16:02:13 | * | kunev joined #nim |
16:02:41 | Nikky | luckily i do not need libtorrent immideatly and i can try to use ffmpeg through calling the binary as well |
16:02:48 | Nikky | not as pretty but it works |
16:03:13 | * | PMunch quit (Read error: Connection reset by peer) |
16:05:26 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
16:07:48 | FromGitter | <Varriount> Nikky: I got something, need araq for further directions |
16:08:11 | Araq | yes? |
16:08:57 | FromGitter | <Varriount> Araq: Will using {.compile: "xxx.cpp".} call the compiler *and* linker on "xx.cpp", or only the compiler? |
16:09:28 | Araq | both. |
16:10:23 | FromGitter | <Varriount> Will it call the right compiler? |
16:10:33 | FromGitter | <Varriount> I mean, use a C++ compiler for C+ files, etc |
16:11:01 | * | dom96|w joined #nim |
16:11:19 | LyndsySimon | Is there a REPL for Nim? |
16:12:47 | Araq | I think so but the common compilers can all handle .cpp files |
16:13:56 | dom96|w | LyndsySimon: Not really |
16:14:10 | Nikky | and the library.cpp file itself with have #inlcude <boost/bind.hpp> will that cause any big issues ? |
16:14:11 | FromGitter | <Varriount> nim secret sorta works. |
16:14:35 | FromGitter | <Varriount> Nikky: I'm running into syntax errors, although that might be because the header files haven't gone through the build process |
16:14:59 | LyndsySimon | "nim secret" is the least googleable name I've ever seen for something. |
16:15:53 | Nikky | do you think preprocessing the hpp files would help ? |
16:16:11 | Nikky | to set a configuration sorta |
16:16:38 | FromGitter | <Varriount> lyndsysimon: type it in your console |
16:16:50 | FromGitter | <Varriount> Nikky: That will remove all the templates |
16:17:19 | * | yglukhov joined #nim |
16:18:13 | FromGitter | <Varriount> Bah, building libtorrent gives me the same errors. |
16:18:28 | FromGitter | <Varriount> Nikky: I have to go to work now, I'll look into this later |
16:19:11 | Nikky | i never build libtorrent.. i actually gave up ontriyng to build it onw windows and just took the ready to use .so file on my linux laptop |
16:19:24 | Nikky | ok.. thanks for the help.. |
16:19:47 | * | shashlick quit (Quit: Connection closed for inactivity) |
16:19:57 | Nikky | although i think nim might not be the best choice of language for the task.. maybe i have ot learn and use go instead |
16:19:57 | FromGitter | <Varriount> Nikky: The problem is with C++ |
16:20:12 | Nikky | or some other language that has the bindings |
16:21:58 | LyndsySimon | Varriount: Huh. Thanks :) |
16:22:48 | Nikky | just one question.. how do i close nim secret ? |
16:22:51 | * | abeaumont joined #nim |
16:22:56 | FromGitter | <Varriount> quit() |
16:23:09 | Nikky | heh |
16:24:03 | FromGitter | <ephja> what were the issues with the C header? unexported symbols? |
16:24:17 | FromGitter | <ephja> if so, did they not start with _ for example? |
16:25:09 | * | Snircle joined #nim |
16:25:26 | FromGitter | <Varriount> ephja: Invalid syntax in libtorrent source code. |
16:25:46 | Nikky | there exists a .h file but the dev decided to rather write a mini wrapper librar that links c to cpp code .. |
16:26:13 | FromGitter | <Varriount> Nikky: If you can, wait until this weekend before switching. I'll have some time to help then. |
16:27:06 | FromGitter | <ephja> um ok |
16:27:38 | FromGitter | <Varriount> nimtorrent/library.cpp:63:6: error: expected expression |
16:27:45 | FromGitter | <Varriount> , (libtorrent::torrent_handle const& h) { return !h.is_valid(); }); |
16:27:49 | FromGitter | <ephja> ah, the joys of archaic practices |
16:28:20 | Nikky | sure i can wait.. i will try around with other languages as well though to see which ones might be able to have the right balance between nice syntax, features and available bindings and tools |
16:29:15 | Nikky | although for projects not involving dependencies on cpp shit i guess nim would be one of my first choices :P |
16:29:21 | FromGitter | <Varriount> The thing is, Nim will never have bindings and tools if people don't work on them. :/ |
16:29:41 | vivus | Nikky: what are you attempting to build? |
16:29:59 | Nikky | a cluster transcoder |
16:30:26 | Nikky | split a video, send it to different clients, trnascode a bit on each, then send it back |
16:30:37 | Nikky | well thats one of the things i need ffmpeg for |
16:31:35 | FromGitter | <ephja> I wish I was capable of working on anything remotely complicated |
16:34:55 | enthus1ast | Nikky maybe this is not what you want but you "could" start an aria2 and talk to it via websocket.... |
16:36:05 | * | pilne joined #nim |
16:36:20 | Nikky | nah not really .. i think |
16:36:42 | vivus | Nikky: maybe you can build the binding :) chicken/egg problem small communities have |
16:36:46 | Nikky | although it looks interesting |
16:37:41 | * | kier joined #nim |
16:38:12 | FromGitter | <ephja> do you all use a debugger when hacking the compiler? |
16:41:11 | * | yglukhov quit (Remote host closed the connection) |
16:41:44 | * | yglukhov joined #nim |
16:44:09 | FromGitter | <Varriount> Situations like this are so frustrating. Nim is a *good* language. The only thing that prevents it from becoming better known is lack of support. |
16:44:57 | * | kier quit (Ping timeout: 240 seconds) |
16:46:37 | * | yglukhov quit (Ping timeout: 276 seconds) |
16:48:30 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
16:51:06 | Araq | ephja: no, I don't. I find debuggers worthless with Nim's code. I've explained why that is multiple times here. |
16:52:12 | Araq | varriount: more documentation about C++ wrapping can help |
16:53:06 | FromGitter | <ephja> sometimes it takes a while to figure out where to dump the stack trace |
16:55:17 | FromGitter | <Varriount> Nikky: Got a bit further |
16:55:27 | FromGitter | <Varriount> Anyone know how to link to a DLL using clang? |
16:55:38 | FromGitter | <Varriount> I'm getting this: |
16:55:43 | FromGitter | <Varriount> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5955310fad9c781843b2ee93] |
16:56:54 | FromGitter | <ephja> btw, I thought a stack trace would be dumped implicitly at the end with verbosity:3 but I guess not |
16:57:00 | * | nsf joined #nim |
16:57:10 | * | bahtiyar joined #nim |
16:57:11 | FromGitter | <Varriount> ephja: Have you built the compiler with stack traces enabled? |
17:01:37 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:05:16 | FromGitter | <ephja> @Varriount I guess I should use the fatal pragma for example |
17:13:30 | FromGitter | <ephja> Araq: It must help with figuring out the control flow |
17:14:24 | * | PMunch joined #nim |
17:18:02 | FromGitter | <ephja> 路 |
17:18:52 | FromGitter | <Varriount> Nikki: Any idea how to solve my error? I think we're getting close. |
17:23:38 | * | PMunch quit (Remote host closed the connection) |
17:23:46 | * | PMunch joined #nim |
17:24:02 | PMunch | Phew |
17:24:04 | PMunch | Close call |
17:24:21 | * | Jesin quit (Quit: Leaving) |
17:25:15 | PMunch | My machine locked up, thought it might be that the lock-screen had activated without updating the screen somehow. So I tried to type my password, but fortunately I saw that hexchat had focus and pulled my ethernet plug before I hit enter :P |
17:25:47 | FromGitter | <ephja> I know it's hunter2 |
17:25:56 | FromGitter | <Varriount> :O |
17:26:32 | PMunch | Haha, you got me ephja :P |
17:26:40 | PMunch | One sec |
17:26:41 | * | PMunch quit (Client Quit) |
17:26:58 | * | PMunch joined #nim |
17:29:06 | PMunch | Just wanted to delete my password from the hexchat scrollback :P |
17:29:24 | * | Matthias247 joined #nim |
17:31:27 | Araq | typing passwords to give admin rights is a bizarre thing. when I started with Linux I was like "wtf, I'm not a moron, I still know my pw, do you too?" |
17:32:37 | * | shashlick joined #nim |
17:33:00 | PMunch | Well, it's a security thing. You have to authenticate that you are an admin to be able to do admin tasks |
17:33:00 | Araq | typical unix solution imo. why come up with a decent solution when you can boss around your users instead. |
17:33:57 | Araq | Windows does without it :P |
17:34:14 | PMunch | Not if your user is not administrator |
17:34:17 | PMunch | Then it's the same |
17:34:42 | Araq | Windows shows a popup and makes you click "OK" |
17:34:51 | Araq | totally different solution. |
17:35:00 | PMunch | That only happens if your user has admin rights |
17:35:07 | PMunch | If not it shows a password dialog |
17:35:12 | FromGitter | <Varriount> Araq: Only if "you" (the user) already have the correct permissions. |
17:35:23 | Araq | so? |
17:35:28 | shashlick | Araq: sorry had to sleep last night. If you do readFile() on large files in a loop, the memory isn't getting freed and I run out of memory. |
17:35:47 | Araq | I'm an admin on my own machine, yes. |
17:35:55 | PMunch | Araq, you could always add your user to the sudo group if you wanted to. Not a good idea, but you can do it :P |
17:36:53 | Araq | shashlick: that's news to me. can you file a github issue? with an example input file that shows this behaviour? |
17:37:25 | shashlick | Sure, I'll also update to head and try to recreate before i file |
17:37:50 | Araq | PMunch: it doesn't matter, "sudo" doesn't protect my homedir which is the only thing worth protecting |
17:38:35 | PMunch | Well, your home dir should be protected in a different way. For example by scheduled back-ups |
17:38:55 | FromGitter | <Varriount> Araq: I dunno, my *nix home directory doesn't feel that important. If it was, why do programs keep putting dozens of dotfiles in it? |
17:38:57 | PMunch | You don't want something installing a system service that constantly leaks your data for example |
17:39:37 | * | Jesin joined #nim |
17:40:07 | Araq | what's special about a system service? clang could easily send my homedir to some server without me noticing |
17:40:35 | PMunch | Yeah, and to install clang you would need to authorize it through sudo |
17:40:43 | Araq | just admit there is no "security" concept for desktops to speak of :P |
17:41:04 | Araq | I can install clang without 'sudo', in fact that's how I install 'nim' ... |
17:41:05 | FromGitter | <Varriount> PMunch: Not if clang get's installed to the home directorie's bin |
17:41:23 | PMunch | Hmm, that's true |
17:41:35 | PMunch | But then you would have to launch it manually. |
17:41:42 | * | nhywyll joined #nim |
17:41:43 | PMunch | It wouldn't just automatically start |
17:43:59 | Araq | when I write my own OS it will have a permission system by application. clang is allowed to read .cpp files in certain folders, but not .jpgs. I wonder if this would be an endless pita in practice or not. :-) |
17:44:56 | FromGitter | <Varriount> Araq: Sandboxing |
17:46:37 | PMunch | But would you be able to rename files Araq? Or do you plan on identifying file-types on the fly? |
17:57:41 | Araq | PMunch: renaming is allowed but file extension renames wouldn't be allowed for most apps |
17:58:16 | PMunch | What about downloads? Downloading a file that has .cpp extension but is actually a .png? |
17:58:25 | PMunch | Or file creation for that matter :P |
17:59:07 | Araq | so chrome and curl can create filenames of arbitrary extension but not read them :P |
17:59:42 | Araq | a .png that is named .cpp is a .cpp file. |
18:02:24 | Araq | PMunch: "it wouldn't automatically start" is not that helpful on a laptop where nothing gets restarted all that often |
18:04:32 | dom96 | I love how my talk has such a high amount of views relative to others from NI dev conf heh |
18:04:55 | dom96 | Btw I think I am much better off recording something in the peace and quiet of my home |
18:05:09 | LyndsySimon | dom96: link? |
18:05:33 | dom96 | I've been wanting to do that for a while, I think it will reach more people, be more valuable and hopefully better quality too. |
18:05:40 | dom96 | https://www.youtube.com/watch?v=4D2ryw7tyBA&t=201s |
18:05:47 | dom96 | https://www.youtube.com/watch?v=4D2ryw7tyBA |
18:09:10 | LyndsySimon | I'm probably going to PyOhio next month; I might put together a quick lightning talk about Nim. |
18:09:32 | shmup | where at in ohio? |
18:09:33 | LyndsySimon | Comparing Nim's types to Python's type annotations would probably be a good way to get people interested and exposed to it. |
18:09:37 | LyndsySimon | Columbus. |
18:09:52 | shmup | cool. i lived there briefly (and cleveland). from findlay tho |
18:09:53 | dom96 | LyndsySimon: Awesome. Sounds like a good plan. |
18:10:36 | LyndsySimon | I'm originally from Arkansas, but have been in Virginia for the last four years. |
18:10:50 | FromGitter | <ephja> are 0 length arrays supposed to work? if so, should [] work? |
18:11:22 | PMunch | Arrays? |
18:11:36 | PMunch | Why would you want a 0 length array? |
18:12:06 | federico3 | the concept of user privilege separation exists in many OSes and devices and predates Unix https://en.m.wikipedia.org/wiki/Superuser |
18:12:22 | FromGitter | <ephja> I dunno. array[0, int] works. "var x: array[0, int] = []" doesn't |
18:12:51 | * | Sentreen quit (Ping timeout: 240 seconds) |
18:14:44 | FromGitter | <Varriount> Oh wonderful: https://github.com/arvidn/libtorrent/issues/2111#issuecomment-312051030 |
18:15:18 | FromGitter | <ephja> booooooo! |
18:17:36 | Araq | it should work, empty arrays are used throughout the compiler |
18:19:14 | PMunch | Varriount, ouch |
18:21:04 | FromGitter | <Varriount> Nim is great at interfacing with C. C++ is a different beast though |
18:23:42 | Araq | it is great at c++, considering the competition and how hard it is to do |
18:25:42 | * | Sentreen joined #nim |
18:27:27 | shashlick | Araq: have submitted issue after additional tests. https://github.com/nim-lang/Nim/issues/6031 |
18:30:25 | FromGitter | <Bennyelg> Hey how to upgrade Nim |
18:30:46 | PMunch | Bennyelg, how did you install it? |
18:30:58 | Araq | shashlick: already replied |
18:31:46 | shashlick | Araq: I see what you are saying |
18:32:02 | shashlick | But why can't i force the GC to clean up? |
18:32:22 | FromGitter | <Bennyelg> if I remember correctly: sh build.sh ⏎ bin/nim c koch ⏎ ./koch tools |
18:32:40 | dom96 | Bennyelg: consider using choosenim for this |
18:32:46 | Araq | the GC has no chance, these things are still alive |
18:33:49 | Araq | GC_collect does not mean "nuke the memory", it still has to adhere to some rules. |
18:34:13 | shashlick | But shouldn't they get cleaned up when you return to parent? Cause i see sibling directories adding up as well |
18:35:02 | shashlick | Regardless, i don't understand it well enough to argue, will try to change the logic |
18:35:27 | shashlick | Will it help if the read happens in a spawned thread? |
18:35:35 | FromGitter | <Bennyelg> What is going on with jester web framework, is it going to be upgraded soon? for production use |
18:35:46 | Araq | shashlick: yes that can help too but seems overkill |
18:35:58 | shashlick | Ok will try thanks |
18:36:19 | shashlick | Should I close the issue or leave it |
18:37:21 | FromGitter | <Varriount> @Bennyelg What do you mean? |
18:37:59 | FromGitter | <Bennyelg> I mean, I can relay on this framework to work on stressfull system? with a lot of requests ? |
18:38:34 | Araq | shashlick: I need to investigate further. will close it afterwards. this is just my hypothesis |
18:41:11 | dom96 | bennyelg: yes. The forum has been running in production for years now. |
18:41:23 | dom96 | irclogs.nim-lang.org is also served via jester |
18:41:35 | dom96 | Have you ever seen it down? |
18:41:41 | dom96 | I sure haven't |
18:41:41 | FromGitter | <Bennyelg> nop :) |
18:42:10 | FromGitter | <Varriount> @Bennyelg That being said, I believe nginx is recommended as a front-end (for SSL and other goodies) |
18:42:31 | FromGitter | <Bennyelg> I building a loadindex service which needs to handle around 10k requests per minute |
18:42:32 | PMunch | I've also used Apache as a reverse proxy for Jester, works great |
18:43:31 | * | yglukhov joined #nim |
18:43:44 | FromGitter | <Varriount> @dom96 Has the forum ever been stress-tested with that kind of load? |
18:43:49 | Araq | 10K req/s should be fine |
18:43:54 | Araq | iirc |
18:43:58 | dom96 | It was on HN |
18:44:01 | shashlick | Araq: Okay thanks. In my sample code, I'm calling readFile() directly in the loop, but in my actual code, I'm calling secureHashFile() which calls readFile() inside it. I only get the hash value into the main loop, the readFile() contents should get cleared on function return or sometime. It should no longer be on the stack really but again, I don't understand this well enough. |
18:44:02 | dom96 | multiple times |
18:44:12 | dom96 | It was absolutely fine |
18:44:31 | Araq | HN doesn't cause 10K req/s |
18:44:41 | dom96 | Of course it doesn't. |
18:44:51 | dom96 | But it still kills many sites |
18:45:07 | dom96 | I've seen a blog article return a 504 just yesterday because it was on HN |
18:45:22 | FromGitter | <Bennyelg> Well, I'll run a nice POC and let you know about it and what is the latency we got |
18:45:25 | PMunch | The classic hug of death :P |
18:46:38 | FromGitter | <Bennyelg> another question: what about the printed books, are they shipped to those who bought it ? |
18:47:47 | * | yglukhov quit (Remote host closed the connection) |
18:48:12 | FromGitter | <Varriount> @Bennyelg Don't forget to compile with -d:release and link-time optimizations |
18:48:26 | Araq | Bennyelg: I optimized the forum heavily. by tweaking the sqlite schema (missing indexes). jester/nim had nothing to do with the slowness |
18:48:38 | Araq | well ok, not "heavily" |
18:48:57 | Araq | but it got slower and slower until I fixed the schema. |
18:49:14 | * | yglukhov joined #nim |
18:49:25 | FromGitter | <Bennyelg> Ok but this is nothing todo with jester it's a DB issues :) |
18:50:05 | Araq | yeah sure. but I blamed jester :P |
18:50:20 | FromGitter | <Bennyelg> Oh heheh |
18:50:52 | dom96 | Bennyelg: still working on it, sorry |
18:51:51 | * | v17d quit (Ping timeout: 240 seconds) |
18:52:59 | FromGitter | <Bennyelg> :) Maybe we will get some Bonos chapters :P |
18:57:17 | * | aerx joined #nim |
18:58:11 | * | salewski joined #nim |
18:58:35 | shashlick | Is it possible to convert a raw buffet |
18:58:59 | shashlick | Ugh, raw buffer into a string without a copy |
19:02:28 | FromGitter | <Varriount> shashlick: Is the buffer tracked by the GC? |
19:02:53 | shashlick | No, alloc() |
19:02:56 | * | vivus quit (Quit: Leaving) |
19:03:31 | FromGitter | <Varriount> Well, you can always try mangling data into a string structure... but you would have to be very, very careful to not confuse the GC. |
19:03:39 | FromGitter | <Varriount> shashlick: Why do you need a string structure? |
19:06:06 | * | tankfeeder joined #nim |
19:06:11 | shashlick | Varriount: well, the defect I just filed, 6031, not able to readFile() on large files when recursing, so am trying to read file contents using fread() and pass it as a string to securehash, and then dealloc the memory myself. |
19:06:52 | shashlick | rather than having to rewrite the entire algorithm |
19:07:21 | * | tankfeeder left #nim (#nim) |
19:08:40 | subsetpark | dom96: do I need to do something specific with jester to allow it to serve multiple requests at once? or does it not have threading built in? |
19:09:27 | * | nsf quit (Quit: WeeChat 1.7.1) |
19:10:09 | FromGitter | <singularperturbation> IIRC, jester is async (think event loop) |
19:10:11 | * | dexterk_ quit (Quit: Konversation terminated!) |
19:10:23 | * | dexterk_ joined #nim |
19:10:33 | FromGitter | <singularperturbation> so it's single-process but can handle multiple requests if doing non-blocking I/O (not CPU-bound) |
19:10:47 | FromGitter | <Varriount> shashlick: I don't know why we have that module. SHA-1 is broken. |
19:10:49 | FromGitter | <Varriount> https://en.wikipedia.org/wiki/SHA-1 |
19:11:13 | subsetpark | singularpertubation, yes - unfortunately the work i'm doing is CPU bound |
19:11:31 | FromGitter | <Varriount> subsetpark: Spin off worker threads to do the heavy lifting? |
19:11:33 | FromGitter | <singularperturbation> I've thought about (but haven't tried) putting https://github.com/stripe/einhorn in front of jester to essentially have one worker / CPU |
19:11:39 | subsetpark | Varriount - seems like it |
19:14:05 | subsetpark | With true threads, I can get concurrency even for CPU bound tasks, right? I'm used to Python where threading only occurs at IO boundaries... |
19:14:21 | shashlick | Varriount: it may be broken, but even if I change the hashing algo, I still need readFile() which doesn't GC the memory when recursing. |
19:14:38 | FromGitter | <Varriount> shashlick: https://github.com/nim-lang/Nim/issues/6031 - Araq says that the recursion is what's causing the memory leak |
19:15:41 | FromGitter | <Varriount> If you need to, remove the reference to the string from the stack, or explicitly overwrite it with a smaller string |
19:16:21 | FromGitter | <Varriount> Araq: Does setLen(0) free up memory? |
19:17:13 | shashlick | Varriount: there's no reference to it in my code - readFile() is used within securehash. Even if I did the readFile() myself, how do I remove it? |
19:17:18 | shashlick | Oh that's an idea |
19:18:44 | dom96 | subsetpark: you want parallelism |
19:18:51 | dom96 | async only gets you concurrency |
19:19:04 | subsetpark | yeah |
19:21:48 | shashlick | Setting string to a shorter value doesn't release the memory |
19:21:54 | FromGitter | <Varriount> Eeew |
19:22:06 | salewski | Varriount, I am nearly sure setLen(0) will not free memory. Because generally we want to reuse memory. |
19:22:24 | FromGitter | <Varriount> shashlick: Do ` = ""` then |
19:22:26 | salewski | Maybe we should have setLen(-1) to free mem. |
19:22:49 | shashlick | That didn't work |
19:22:58 | shashlick | Setlen also didn't work |
19:23:32 | subsetpark | dom96 Varriount - I'm not sure what do with the return value of `spawn` - what's the simplest way to read the value returned by the thread? |
19:23:34 | FromGitter | <Varriount> shashlick: Any reason you can't use the builtin hash module - https://nim-lang.org/docs/hashes.html ? |
19:23:45 | dom96 | subsetpark: ^flowVar |
19:23:56 | FromGitter | <Varriount> Won't that block though? |
19:24:01 | dom96 | We need to unify this FlowVar stuff with Future |
19:24:06 | dom96 | yes, it will. |
19:24:36 | subsetpark | so, how do i read it without blocking the main thread? |
19:24:52 | shashlick | Varriount: I still need to read the entire file into memory for hashes to process it, regardless, the memory sits around. |
19:25:33 | * | salewski quit (Quit: WeeChat 1.4) |
19:26:21 | dom96 | subsetpark: Currently the only way I've been able to do it isn't very nice. But it is shown in my book so it will be supported :) https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L39 |
19:26:46 | FromGitter | <Varriount> shashlick: If you need to read an entire file into memory, use memfiles and/or read segments of the file into a null-terminated array/cstring |
19:26:49 | dom96 | I will also make this type of thing much easier to do, because it comes up incredibly often. |
19:27:01 | dom96 | But basically you have to poll the FlowVar |
19:27:20 | dom96 | when you're polling asyncdispatch |
19:27:47 | subsetpark | dom96: yes, I remember that line! So I assume isReady yields inside an async context? |
19:27:50 | FromGitter | <Varriount> shashlick: What are you doing again? And why does it require recursion? |
19:28:04 | dom96 | subsetpark: nope |
19:28:26 | subsetpark | oh, is that the .poll() call at the bottom? I can't tell what scope it's in |
19:28:37 | dom96 | This code isn't inside any async context |
19:28:40 | dom96 | it's just normal Nim code |
19:28:54 | dom96 | You should read my book ;) |
19:29:05 | * | bahtiyar_ joined #nim |
19:29:56 | shashlick | Varriount: i'm trying the latter - reading into a buffer I allocate and then free later. But it's a raw buffer so that's why wondering how to show it as a string to hashes without having to create a new string memory block which will again sit around. |
19:30:25 | * | bahtiyar quit (Ping timeout: 276 seconds) |
19:30:42 | shashlick | Varriount: basically I'm recursing through a directory of files, looking for duplicates. |
19:30:55 | subsetpark | dom96: be that as it may, my code is in a jester route, so it's async by definition |
19:31:24 | dom96 | subsetpark: You won't be able to put it in there I'm afraid |
19:31:27 | FromGitter | <Varriount> shashlick: You don't need recursion for that. |
19:31:30 | dom96 | you'll need to use a global variable or something |
19:31:43 | dom96 | You can't poll the async dispatcher inside an async procedure |
19:31:53 | subsetpark | oh jeeze :/ |
19:32:00 | subsetpark | I can't just yield if it's not ready? |
19:33:29 | shashlick | Varriount: ya I agree with that, but sad that the GC doesn't take care of this use case, recursion is such a standard approach |
19:33:58 | dom96 | subsetpark: hrm, actually that might work |
19:34:24 | dom96 | but put a sleepAsync in there. |
19:34:52 | dom96 | otherwise it will busy wait constantly and not let any other code run in your main thread |
19:34:55 | FromGitter | <Varriount> shashlick: Again, I think setLen() should decrease as well as increase memory (perhaps with a flag or something). |
19:36:23 | shashlick | I tried with 0 and it didn't |
19:38:38 | FromGitter | <Varriount> shashlick: Sorry, I meant, "I think setLen() should be changed so that it decreases memory too" |
19:38:47 | subsetpark | dom96 https://www.irccloud.com/pastebin/S8jb5BrV/ |
19:39:19 | shashlick | Oh ok |
19:39:23 | dom96 | subsetpark: await instead of asyncCheck |
19:39:40 | dom96 | 'await' == 'yield' |
19:39:49 | subsetpark | oh right, forgot that |
19:40:17 | dom96 | hrm, if this works then it would actually be pretty easy to create an 'await' for FlowVars |
19:40:35 | FromGitter | <Varriount> shashlick: Oh, try this: https://nim-lang.org/docs/hashes.html#hashData,pointer,int |
19:40:37 | dom96 | It's not very efficient of course, but we can optimise it later |
19:40:53 | FromGitter | <Varriount> shashlick: Memory map the file and then use hashData on the contents |
19:40:57 | subsetpark | dom96: looks like it's working; the only thing is, how to check for exceptions? |
19:41:50 | dom96 | Ugh, wish Araq didn't reuse 'await' for a blocking read of the FlowVar... |
19:41:50 | FromGitter | <Varriount> shashlick: You'll want to call close() though |
19:42:18 | dom96 | subsetpark: good question. I'm not sure, test it. |
19:42:29 | dom96 | Hopefully `^` raises the exception |
19:43:33 | shashlick | Will try it Varriount |
19:43:59 | FromGitter | <Varriount> shashlick: Hrm, also, the memfiles module isn't 100% memory safe. |
19:44:12 | shashlick | What algorithm does hashes use |
19:44:28 | FromGitter | <Varriount> The memfiles type is an object, and there's no finalizer/destructor |
19:48:55 | shmup | ftsf: just curious, why no textHeight? :P |
19:51:40 | shashlick | Varriount: is fread() slower than memfiles? |
19:52:55 | FromGitter | <Varriount> shashlick: Yes. Possibly. |
19:57:36 | PMunch | Hmm, speaking of C APIs and such (from earlier). Have anyone had any luck in writing a C API in Nim? |
19:58:00 | FromGitter | <Varriount> PMunch: I don't know if anyone has tried. |
19:58:40 | FromGitter | <Varriount> PMunch: The biggest difficulty I can think of when using Nim for a C API is starting up the garbage collector. |
19:59:16 | PMunch | I did find this: http://gradha.github.io/articles/2015/01/writing-c-libraries-with-nim.html |
19:59:30 | PMunch | Yeah, that would probably be pretty odd.. |
20:00:27 | * | bahtiyar_ quit (Ping timeout: 240 seconds) |
20:00:47 | FromGitter | <Varriount> PMunch: But plenty of libraries have an initialization route that needs to be called first. |
20:05:39 | FromGitter | <Varriount> Araq: Any particular reason the MemFile type isn't memory safe? Wouldn't it have been better to make it a reference type and attach a finalizer? |
20:07:29 | * | smt quit (Ping timeout: 258 seconds) |
20:07:47 | Araq | varriount: yes, it would be ridiculous IMO :-) |
20:08:02 | Araq | you write to a pointer that writes through to the hard disk (conceptually) |
20:08:12 | Araq | that's as unsafe as you can get |
20:10:30 | shashlick | Varriount: hashes only gives me a numeric value, won't be unique for file contents to identify duplicates right? |
20:11:18 | FromGitter | <Jeff-Ciesielski> Araq: Is there any way during execution (in normal code) to detect that you're in the VM and need to act accordingly? I'd like to be able to parse XML at compile time, but I'm having a devil of a time doing it as lexbase uses a cast. There is code in lexbase to handle the js case and I think the same can be done in the VM |
20:11:56 | Araq | 'when nimvm' iirc |
20:12:18 | Araq | but it's a bit restricted grep for it please to see how it can be used |
20:12:43 | FromGitter | <Jeff-Ciesielski> :+1: |
20:13:19 | FromGitter | <Jeff-Ciesielski> I seem to recall trying that, but maybe I overlooked it. Will check again, thanks |
20:26:30 | * | yglukhov quit (Remote host closed the connection) |
20:28:27 | * | yglukhov joined #nim |
20:29:47 | * | v17d joined #nim |
20:31:55 | * | Trustable quit (Remote host closed the connection) |
20:32:15 | subsetpark | dom96: how can I tell nimble to call `--threads:on` in `nimble build`? |
20:32:27 | * | Jesin quit (Quit: Leaving) |
20:32:38 | dom96 | add to .nim.cfg |
20:34:35 | subsetpark | so i add a myproject.nim.cfg file with the flags to pass to the nim compiler? |
20:34:38 | FromGitter | <Varriount> shashlick: That's what a SHA-1 hash is too. |
20:35:26 | subsetpark | interesting... |
20:35:32 | FromGitter | <Varriount> shashlick: Compare the length and hash of the file, and you shouldn't get any collisions |
20:36:19 | FromGitter | <Varriount> Actually, getting the size of a file is probably a better way to detect initial duplicates. |
20:46:59 | * | v17d quit (Remote host closed the connection) |
20:48:37 | * | nsf joined #nim |
20:50:09 | FromGitter | <ephja> subsetpark: yes, <project>.nim.cfg or nim.cfg |
20:52:04 | demi- | dom96: i'm having trouble installing nim 0.16.0 from choosenim. is there a way to do this or is this a bug i should be filing? |
20:52:35 | dom96 | demi-: what's the error? |
20:56:30 | demi- | one sec and i can grab them |
21:00:02 | demi- | dom96: http://magic.pewpewthespells.com/2I3m0O2i0f2a |
21:01:34 | demi- | that was from running `choosenim "#v0.16.0"`, because i tried to install via just `choosenim 0.16.0` and i get error messages about nimble 0.8.2 not being compatible |
21:01:34 | dom96 | "Building from latest C sources. They may not be compatible with the Nim version you have chosen to install." |
21:01:43 | FromGitter | <Varriount> Araq: I would prefer memory safety and a higher-level interface, much like Python's mmap module. |
21:01:48 | dom96 | I'm guessing the C sources were updated |
21:01:55 | dom96 | and so are not compatible with 0.16.0 :\ |
21:02:19 | demi- | aren't the C sources tagged with releases so i can download those versions? |
21:02:27 | dom96 | nope |
21:02:30 | demi- | D: |
21:02:46 | dom96 | hrm, I guess they're hosted on the website though |
21:03:26 | * | bjz joined #nim |
21:03:45 | demi- | because as it stands, 0.17.0 broke the yaml library so i can either rip that out of a bunch of things and replace it with parsecfg or toml so that things will build or i could just build against 0.16.0 |
21:04:17 | dom96 | I suppose I could get choosenim to parse the version from '#v0.16.0' and grab 0.16.0 C sources from the website. |
21:04:28 | demi- | i'd be up for doing either, but atm i just want things to work |
21:04:41 | dom96 | Yeah, I understand. Sorry :\ |
21:04:58 | dom96 | What you can do as a workaround is: choosenim 0.16.0 |
21:05:00 | FromGitter | <Varriount> Noooo, not NimYAML |
21:05:19 | demi- | dom96: yeah i tried that but i am unable to use nimble |
21:05:20 | dom96 | cp ~/.choosenim/toolchains/nim-{0.17.0,0.16.0}/bin/nimble |
21:05:32 | dom96 | (path might be a bit different) |
21:05:40 | demi- | and i'm not sure why i cannot use nimble |
21:05:47 | demi- | Varriount; indeed :( |
21:05:47 | * | Jesin joined #nim |
21:06:21 | dom96 | Araq: Isn't breaking yaml a pretty big deal? Is this fixed in devel? Can we release 0.17.2? |
21:06:44 | Araq | dom96: told zahary to fix it |
21:06:46 | demi- | dom96: to be fair; this is a million times better than when i did `sudo apt-get install nim` and got version 0.12.0 |
21:06:55 | dom96 | demi-: heh :) |
21:07:04 | Araq | I agree with you, it warrants a 0.17.2 |
21:07:26 | demi- | and tbh choosenim has been fantastic apart from this one hickup in building 0.16.0 |
21:08:16 | dom96 | yay, thanks :D |
21:08:44 | dom96 | I wonder what else I could do. Maybe a switch to install latest Nimble with older Nim would be better |
21:08:58 | dom96 | Then I can suggest its use, instead of the installation of #v0.16.0 |
21:09:53 | dom96 | We have asked zahary to fix the yaml issue tomorrow :) |
21:10:04 | demi- | cool; thanks! |
21:10:18 | Araq | varriount: what do you mean by "memory safety"? |
21:10:44 | subsetpark | flags-wise, does `nimble install` do anything more clever than -d:release ? |
21:10:46 | Araq | how can Python make memory mapped files "safe"? as I said, its nature is completely unsafe |
21:11:13 | dom96 | Anyway, I will submit a bug report for this. I will link the IRC logs there, so let me know what you guys think is a good solution. |
21:11:58 | mwbrown | Question for you guys: What is the preferred way of communicating between threads created using the threadpool spawn? |
21:12:25 | mwbrown | I can imagine it's a bit more restricted than just regular sync primitives between traditional threads since the spawned functions may share a common worker thread |
21:14:32 | Araq | mwbrown: you don't really communicate, you spawn a task, it returns, that's it. |
21:14:54 | mwbrown | ok. So if I have a producer/consumer thread model it needs to use traditional threads? |
21:15:03 | mwbrown | And threadpool is more for a run-to-completion async/await type deal? |
21:15:28 | Araq | threadpool is about parallelism it's not for concurrency. |
21:15:38 | dom96 | I'm tired so I probably haven't explained it well, but here is the issue nonetheless :) https://github.com/dom96/choosenim/issues/23 |
21:16:38 | * | nhywyll quit (Quit: nhywyll) |
21:17:38 | mwbrown | Araq: I think I understand. Thanks! |
21:26:03 | * | shashlick quit (Quit: Bye) |
21:49:30 | * | Vladar quit (Remote host closed the connection) |
21:51:54 | * | couven92 quit (Read error: Connection reset by peer) |
21:58:37 | * | Matthias247 quit (Read error: Connection reset by peer) |
22:06:29 | shmup | ftsf: what kind of memory usage are you seeing with your nico stuff? |
22:20:56 | * | xet7 joined #nim |
22:21:49 | * | shashlick joined #nim |
22:31:48 | * | rauss joined #nim |
22:34:03 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:38:30 | * | Jesin quit (Quit: Leaving) |
22:42:10 | * | Jesin joined #nim |
22:44:18 | * | rauss quit (Quit: WeeChat 1.8) |
22:50:05 | FromGitter | <Varriount> Araq: Python unmaps the memory on object collection, uses string-like subscript operators for access, etc |
22:54:26 | Araq | safety about forgetting a 'close' call is not memory safety. |
22:54:44 | Araq | a different/nicer syntax for access is not safety. |
23:00:40 | * | nsf quit (Quit: WeeChat 1.7.1) |
23:28:14 | * | bahtiyar joined #nim |
23:41:49 | PMunch | Hmm, is there a way to make Nim coerce non-varargs arguments? |
23:42:25 | PMunch | With varargs you can do "proc something(things: varargs[string, '$'])" |
23:42:39 | PMunch | Can the same be achieved without varargs? |
23:44:19 | FromGitter | <zacharycarter> I think that's what converters are for |
23:44:38 | FromGitter | <zacharycarter> *think* |
23:45:03 | PMunch | Converters are global though.. |
23:45:08 | PMunch | I want this for only one proc |
23:45:52 | FromGitter | <zacharycarter> gotcha |
23:47:08 | FromGitter | <zacharycarter> I don't think so |
23:47:27 | FromGitter | <zacharycarter> but I could be totally rwong |
23:49:37 | * | libman joined #nim |
23:49:37 | * | yglukhov quit (Remote host closed the connection) |
23:50:17 | * | yglukhov joined #nim |
23:54:44 | * | yglukhov quit (Ping timeout: 260 seconds) |