<< 29-06-2017 >>

00:00:49FromGitter<zacharycarter> hrm I'm binding to the C API, so the C++ docs may be off
00:01:23FromGitter<zacharycarter> ``````
00:02:13FromGitter<zacharycarter> terminal_close() shouldn't return anything it should just be a void function
00:02:25FromGitter<zacharycarter> if you're not opening the terminal first, that's the only reason I can think it'd throw an error
00:03:20LyndsySimonI've beat at it enough; one sec I'll push my current state.
00:03:48FromGitter<zacharycarter> cool
00:04:50LyndsySimonError message: roguelike.nim(7, 25) Error: expression 'terminal_refresh()' has no type (or is ambiguous)
00:05:06LyndsySimoncode: https://gitlab.com/lyndsysimon/roguelike-nim/blob/blt/src/roguelike.nim
00:06:11FromGitter<zacharycarter> ah okay so these are compiler errors
00:06:17FromGitter<zacharycarter> one sec I'll set you up with an example
00:06:29LyndsySimonThanks :)
00:06:48LyndsySimonI get the difference between compile-time and run-time errors. I'll be more specific when discussing it in the future.
00:08:26FromGitter<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:18LyndsySimonLooks that way - back to the malloc error that I believe is unrelated.
00:09:28LyndsySimonAh, OK. So you don't have to discard a void.
00:09:46LyndsySimonAlso, that means that void and null are different things...
00:09:52FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5954455076a757f808b7cd18]
00:09:57FromGitter<zacharycarter> yes they are
00:11:05LyndsySimonAwesome! That runs and terminates without throwing errors
00:11:46LyndsySimonFWIW, 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:57LyndsySimonI'm pretty impressed with the error output.
00:14:57FromGitter<zacharycarter> yeah it takes time getting used to the compiler, it can be extremely cryptic at times
00:15:39FromGitter<zacharycarter> most of the time though you get one of several types of warnings / errors
00:16:17FromGitter<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:05libmanfsmonitor is being discussed at https://www.reddit.com/r/programming/comments/6jyk34/nim_intro_talk_a_young_systems_programming/dji6ase/ - "Linux only"?
00:27:24libmanLinks 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:45shmupIf 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:50shmupI may have worded that very poorly
01:29:42shmuphttps://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:23chrishellershmup: that looks OK.
02:05:43*chemist69 joined #nim
02:05:47chrishellerHow are you populating ''callback''
02:07:51LyndsySimon`echo 5 / 2` prints "2.5". How do I do integer division?
02:07:59LyndsySimon`echo 5 /% 2`?
02:13:49LyndsySimonOK, 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:37chrishellerlet myval = 5 /% 2
02:15:40chrishellermyval.cint
02:17:13LyndsySimonAhhhh
02:17:19LyndsySimonI should have tried that ;)
02:19:50aerxecho -5 /% 2 prints 9223372036854775805
02:19:53aerxis that a bug?
02:19:58*NotSpooky__ joined #nim
02:20:30LyndsySimonaerx: I don't think so. `/%` assume unsigned ints as input.
02:20:52LyndsySimonaerx: I'll bet -5.uint will return a big number :)
02:21:27aerxalright
02:22:28*NotSpooky_ quit (Ping timeout: 255 seconds)
02:23:51aerxjust tested it, but that conversion doesn't seem to be allowed
02:24:09LyndsySimonHmmm. then maybe it should throw an error of some kind.
02:24:17LyndsySimonI don't have enough experience yet to say.
02:29:35aerxecho $((-5).uint) # Error: cannot convert -5 to uint64
02:29:37aerxecho $((-5).uint64) # 18446744073709551611
02:30:29aerxweird
02:32:47shmupchrisheller: 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:03LyndsySimonCan I get a review and some suggestions for this proc? https://gitlab.com/lyndsysimon/roguelike-nim/blob/blt/src/ui.nim
02:34:28LyndsySimonI'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:34shmupah hah, figured it out chrisheller.
02:46:33aerxLyndsySimon: you could use ..< to avoid having to write the "- 1"
02:51:02chrishellerLyndsySimon: x and y will be automatically initialized to 0
02:55:44LyndsySimonaerx: Awesome, thank you! That's handy.
02:57:22LyndsySimonchrisheller: I didn't think about that, cool. That lets me remove a logical branch.
03:03:33FromGitter<girvo> @zacharycarter Thats a shame! I'm having a lot of fun with Frag at the moment :)
03:06:46FromGitter<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:08chrishellergirvo: would be interested in hearing how that goes.
03:14:26FromGitter<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:43FromGitter<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:40LyndsySimonWell... 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:32libmanThe 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:56shashlickafter 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:27shashlickI 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:30Araqshashlick: 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:45PMunchNikky, how's your C porting going?
10:28:22PMunchHuh, didn't know you could import like this: import snake/[game, keyboard, touch]
10:28:54AraqPMunch: that's new'ish
10:29:12PMunchAh okay, just looking at doms snake game :)
10:30:17yglukhovAraq: btw, i think we should complete this bracket import functionality to allow nesting and so on.
10:30:54yglukhovimport snake/[game / [bla, blabla], keyboard / blablabla, touch]
10:34:34Araqmeh ok
10:35:49PMunchThat would be neat
10:36:39*dom96|w joined #nim
10:37:32FromGitter<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:44FromGitter<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:45PMunchzacharycarter a new frag?
10:58:34FromGitter<Varriount> I don't like the idea of all that nesting
10:59:14yglukhovVarriount: why not?
10:59:40FromGitter<Varriount> It's confusing to read.
11:01:45*vivus joined #nim
11:01:51yglukhovVarriount: 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:10yglukhovbut that's basiacally how you could define a e.g. json literal: %*{ "val": { "val": 1, "val2": 2 }, "val2": 2 }
11:04:21yglukhovyour choice to keep your code readable or not
11:05:18FromGitter<zacharycarter> PMunch: yeah, although I'm making 3d a first class citizen this time around and not an after thought
11:05:51PMunchAah, 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:53NikkyPMunch: 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:23PMunchHmm, maybe a bad mapping? What was the error?
11:25:41Nikkyiirc just failed to import
11:25:56Nikkywent to bed after that.. too much frustration
11:26:11*arnetheduck joined #nim
11:26:48Nikkycould not import: session_create
11:28:27AraqNikky: used #cdecl ?
11:28:45Nikkyiirc i did
11:29:41Nikkynot sure though.. might as well start from scratch though
11:38:21PMunchIf 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:55Nikkyi think i see where i made a mistake
11:48:09Nikkylibtorrent itself is written in cpp
11:49:33*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
11:50:20Nikkyand 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:33PMunchNormally you would pass the .h header file to c2nim
11:56:32Nikkywhich 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:56Nikkyi might as well look into converting the original .hpp includes
11:58:01PMunchWell yes, the .cpp file is linked during the build step
11:58:10PMunchAnd you probably want nim cpp instead of nim c
11:58:13*yglukhov joined #nim
11:59:07Nikkyso i inlcude the cpp file instead of trying to convert it ?
12:00:22PMunchWait, which .cpp file?
12:00:27*dom96|w joined #nim
12:00:30Nikkylibrary.cpp
12:00:40PMunchYeah, that is just included
12:00:48Nikkywhich is the file corresponding to libtorrent.h as far as i can see
12:01:19PMunchThe 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:49PMunchAh you're trying to use the C bindings?
12:03:00PMunchYou would probably be better off using the C++ library directly
12:03:19Nikkyi assumed so but they do not convert without issues
12:04:15Nikkywell i can try to.. write a cppp script to preprocess and then run c2nim on them or so
12:04:46PMunchHmm
12:05:51PMunchHold 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:18PMunchHmm Nikky, are you able to build a running version of simple_client.c?
12:31:37Nikkyit compiles.. it doesn ot run as it fails to include / import the libtorrent functions
12:31:47Nikkyported it by hand
12:32:16Nikkytons of cint() and cstring() wrappers required.. would not use that if i had a choice though
12:35:01Nikkybut 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:44FromGitter<ephja> you could do things like defining `or` for enums that represent bit flags
13:16:29Nikkyi would look into that after it runs.. but so far i got nothing to work at all
13:16:51Nikkyat 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:39FromGitter<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:43FromGitter<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:31Nikky@Varriount it is not on github yet
14:49:04PMunchHmm, another fun project for the ever growing TODO list: https://github.com/screenfreeze/deskcon-desktop
14:49:16PMunchCreate something like that in Nim
14:49:28*dexterk_ joined #nim
14:49:38PMunchBut I'm thinking only DBus and then have a completely separate GUI
14:50:55*dexterk quit (Ping timeout: 276 seconds)
14:51:16FromGitter<barcharcraz> I'm having some boot problems when trying to boot using msvc
14:52:27FromGitter<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:37FromGitter<barcharcraz> this is on iteration 2
14:52:38*s joined #nim
14:52:48FromGitter<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:22FromGitter<barcharcraz> Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64
14:54:42Araqbarcharcraz: funny thing. now we need to figure out how MSVC miscompiles Nim
14:55:03FromGitter<ephja> hf
14:55:06FromGitter<barcharcraz> OK so it's unknown
14:55:10FromGitter<barcharcraz> shall I bisect it
14:55:33FromGitter<barcharcraz> if so what's a good old compiler to use
14:55:40FromGitter<barcharcraz> old nim version that is
14:55:52FromGitter<barcharcraz> since the new ones can't always compile the old ones
14:57:49*yglukhov joined #nim
14:58:26dom96|wephja: 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:01Araqbarcharcraz: I don't believe in bisecting :-)
15:00:13FromGitter<barcharcraz> lol wut
15:00:20*rokups quit (Quit: Connection closed for inactivity)
15:00:38Araqbut 0.16 can compile 0.17
15:00:49Araqand every interim step, I think.
15:02:48FromGitter<barcharcraz> and it can compile it using msvc as well
15:03:55*yglukhov quit (Ping timeout: 276 seconds)
15:05:36FromGitter<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:39FromGitter<barcharcraz> meh I'll just make a copy of 0.16.0
15:09:18FromGitter<barcharcraz> btw why don't be believe in bisecting
15:10:23*Guest44275 quit (Quit: Bye)
15:12:10FromGitter<barcharcraz> 13701c09579447d3c54f6a1e27ab24b89b11b9e9
15:12:15FromGitter<barcharcraz> that's the bad commit
15:12:39dom96|wThat's like not believing in gravity :P
15:14:10*SusWombat joined #nim
15:14:12Araqso 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:49Araqthis 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:10FromGitter<barcharcraz> it's a good start
15:16:32PMunchWell it finds the first version your code stopped working in. So something in that last commit broke something
15:16:54Araqif 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:55Araqthe commit that works might just happen to work. because that's the nature of a corruption.
15:18:42Araqbisect is harmful. :P
15:18:56FromGitter<barcharcraz> well codegen obviously changed
15:19:28Araqit can give you the totally wrong ideas.
15:19:52Araqit's not a "good start", it can confuse you moreso than not using it at all.
15:19:57PMunchWell that's true. But it can also allow you to find that one thing that changed
15:26:09Nikkyso this a error i have never seen before in c2nim https://github.com/NikkyAI/nim-libtorrent/blob/master/convert.log#L16
15:26:36Nikkyseems like it cannot handle those templates very well or so
15:27:00*kunev quit (Quit: е те!)
15:28:06FromGitter<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:41PMunchVarriount, he tried that first with little luck..
15:29:02Nikkyi 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:08FromGitter<Varriount> Nikky: What's the .so name?
15:30:26Nikkylibtorrent-rasterbar.so
15:31:40*kunev joined #nim
15:34:42*Trustable joined #nim
15:41:16Nikkyso i have these files.. https://github.com/NikkyAI/nim-libtorrent/tree/master/test_client
15:42:10Nikkyhow do i compile these .nim files with the library.cpp ?
15:44:09*sz0 quit (Quit: Connection closed for inactivity)
15:44:51FromGitter<Varriount> Nikky: Tada - https://gist.github.com/Varriount/67c23e839851474daa6ad28f8fa4fd10
15:45:21FromGitter<Varriount> That will work on Mac, you'll have to tinker around with the libTorrentDllName to find the right pattern
15:46:17FromGitter<Varriount> Hm, wait a moment
15:46:29Nikkyyeah well that far i was as well i think but this did not link
15:47:06Nikkysee https://github.com/NikkyAI/nim-libtorrent/blob/master/test_client/libtorrent.nim
15:47:14Nikkyi just have kept the comments in i guess
15:47:24Nikkycould get rid of them..
15:47:59Nikkybut the corresponding file seems to be the library.cpp and not the dynlib/dll/so file
15:47:59*yglukhov joined #nim
15:48:12FromGitter<Varriount> Nikky: It appears that (my) libtorrent dll doesn't export any of those symbols.
15:48:17Nikkynot entirely sure how that is supposed to work there
15:48:37Nikkyhttps://github.com/NikkyAI/nim-libtorrent/blob/master/test_client/library.cpp
15:48:56Nikkythis file is the other one that is in the c bindings folder..
15:48:58FromGitter<Varriount> Nikky: It appears that this file must be included: https://github.com/arvidn/libtorrent/blob/master/bindings/c/library.cpp
15:49:12Nikkyok well that far i am as well but how ?
15:49:36Nikkyhow do i compile the libtorrent.nim with library.cpp ?
15:49:47Nikkyor do i have to convert librarycpp ?
15:50:49FromGitter<Varriount> Gah. f-ing C++
15:50:52Nikkyfor 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:41Nikkytrying my best not to have to use cpp or c.. and it seems i am getting nowhere :/
15:52:00FromGitter<Varriount> Nikky: One moment
15:52:14Nikkyi have all the time.. take two moments
15:52:40*yglukhov quit (Ping timeout: 276 seconds)
15:56:38FromGitter<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:03FromGitter<Varriount> Or at least, that's part of the solution
15:57:24*kunev quit (Quit: е те!)
15:58:30FromGitter<Varriount> Perhaps you could use this instead: https://github.com/willemt/yabtorrent ?
15:58:43Nikkyso 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:12FromGitter<Varriount> Nikky: Unfortunately, that's what C++ requires.
16:00:13FromGitter<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:22FromGitter<Varriount> :/
16:01:35Nikkywell the libtorrent hpp files are not going to be any help..
16:01:57Nikkyand i only tried libtorrent because i thought i might have faster success than with ffmpeg.. hahaha
16:02:13*kunev joined #nim
16:02:41Nikkyluckily i do not need libtorrent immideatly and i can try to use ffmpeg through calling the binary as well
16:02:48Nikkynot 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:48FromGitter<Varriount> Nikky: I got something, need araq for further directions
16:08:11Araqyes?
16:08:57FromGitter<Varriount> Araq: Will using {.compile: "xxx.cpp".} call the compiler *and* linker on "xx.cpp", or only the compiler?
16:09:28Araqboth.
16:10:23FromGitter<Varriount> Will it call the right compiler?
16:10:33FromGitter<Varriount> I mean, use a C++ compiler for C+ files, etc
16:11:01*dom96|w joined #nim
16:11:19LyndsySimonIs there a REPL for Nim?
16:12:47AraqI think so but the common compilers can all handle .cpp files
16:13:56dom96|wLyndsySimon: Not really
16:14:10Nikkyand the library.cpp file itself with have #inlcude <boost/bind.hpp> will that cause any big issues ?
16:14:11FromGitter<Varriount> nim secret sorta works.
16:14:35FromGitter<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:59LyndsySimon"nim secret" is the least googleable name I've ever seen for something.
16:15:53Nikkydo you think preprocessing the hpp files would help ?
16:16:11Nikkyto set a configuration sorta
16:16:38FromGitter<Varriount> lyndsysimon: type it in your console
16:16:50FromGitter<Varriount> Nikky: That will remove all the templates
16:17:19*yglukhov joined #nim
16:18:13FromGitter<Varriount> Bah, building libtorrent gives me the same errors.
16:18:28FromGitter<Varriount> Nikky: I have to go to work now, I'll look into this later
16:19:11Nikkyi 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:24Nikkyok.. thanks for the help..
16:19:47*shashlick quit (Quit: Connection closed for inactivity)
16:19:57Nikkyalthough 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:57FromGitter<Varriount> Nikky: The problem is with C++
16:20:12Nikkyor some other language that has the bindings
16:21:58LyndsySimonVarriount: Huh. Thanks :)
16:22:48Nikkyjust one question.. how do i close nim secret ?
16:22:51*abeaumont joined #nim
16:22:56FromGitter<Varriount> quit()
16:23:09Nikkyheh
16:24:03FromGitter<ephja> what were the issues with the C header? unexported symbols?
16:24:17FromGitter<ephja> if so, did they not start with _ for example?
16:25:09*Snircle joined #nim
16:25:26FromGitter<Varriount> ephja: Invalid syntax in libtorrent source code.
16:25:46Nikkythere exists a .h file but the dev decided to rather write a mini wrapper librar that links c to cpp code ..
16:26:13FromGitter<Varriount> Nikky: If you can, wait until this weekend before switching. I'll have some time to help then.
16:27:06FromGitter<ephja> um ok
16:27:38FromGitter<Varriount> nimtorrent/library.cpp:63:6: error: expected expression
16:27:45FromGitter<Varriount> , (libtorrent::torrent_handle const& h) { return !h.is_valid(); });
16:27:49FromGitter<ephja> ah, the joys of archaic practices
16:28:20Nikkysure 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:15Nikkyalthough for projects not involving dependencies on cpp shit i guess nim would be one of my first choices :P
16:29:21FromGitter<Varriount> The thing is, Nim will never have bindings and tools if people don't work on them. :/
16:29:41vivusNikky: what are you attempting to build?
16:29:59Nikkya cluster transcoder
16:30:26Nikkysplit a video, send it to different clients, trnascode a bit on each, then send it back
16:30:37Nikkywell thats one of the things i need ffmpeg for
16:31:35FromGitter<ephja> I wish I was capable of working on anything remotely complicated
16:34:55enthus1astNikky 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:20Nikkynah not really .. i think
16:36:42vivusNikky: maybe you can build the binding :) chicken/egg problem small communities have
16:36:46Nikkyalthough it looks interesting
16:37:41*kier joined #nim
16:38:12FromGitter<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:09FromGitter<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:06Araqephja: no, I don't. I find debuggers worthless with Nim's code. I've explained why that is multiple times here.
16:52:12Araqvarriount: more documentation about C++ wrapping can help
16:53:06FromGitter<ephja> sometimes it takes a while to figure out where to dump the stack trace
16:55:17FromGitter<Varriount> Nikky: Got a bit further
16:55:27FromGitter<Varriount> Anyone know how to link to a DLL using clang?
16:55:38FromGitter<Varriount> I'm getting this:
16:55:43FromGitter<Varriount> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5955310fad9c781843b2ee93]
16:56:54FromGitter<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:11FromGitter<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:16FromGitter<ephja> @Varriount I guess I should use the fatal pragma for example
17:13:30FromGitter<ephja> Araq: It must help with figuring out the control flow
17:14:24*PMunch joined #nim
17:18:02FromGitter<ephja>
17:18:52FromGitter<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:02PMunchPhew
17:24:04PMunchClose call
17:24:21*Jesin quit (Quit: Leaving)
17:25:15PMunchMy 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:47FromGitter<ephja> I know it's hunter2
17:25:56FromGitter<Varriount> :O
17:26:32PMunchHaha, you got me ephja :P
17:26:40PMunchOne sec
17:26:41*PMunch quit (Client Quit)
17:26:58*PMunch joined #nim
17:29:06PMunchJust wanted to delete my password from the hexchat scrollback :P
17:29:24*Matthias247 joined #nim
17:31:27Araqtyping 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:00PMunchWell, it's a security thing. You have to authenticate that you are an admin to be able to do admin tasks
17:33:00Araqtypical unix solution imo. why come up with a decent solution when you can boss around your users instead.
17:33:57AraqWindows does without it :P
17:34:14PMunchNot if your user is not administrator
17:34:17PMunchThen it's the same
17:34:42AraqWindows shows a popup and makes you click "OK"
17:34:51Araqtotally different solution.
17:35:00PMunchThat only happens if your user has admin rights
17:35:07PMunchIf not it shows a password dialog
17:35:12FromGitter<Varriount> Araq: Only if "you" (the user) already have the correct permissions.
17:35:23Araqso?
17:35:28shashlickAraq: 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:47AraqI'm an admin on my own machine, yes.
17:35:55PMunchAraq, 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:53Araqshashlick: that's news to me. can you file a github issue? with an example input file that shows this behaviour?
17:37:25shashlickSure, I'll also update to head and try to recreate before i file
17:37:50AraqPMunch: it doesn't matter, "sudo" doesn't protect my homedir which is the only thing worth protecting
17:38:35PMunchWell, your home dir should be protected in a different way. For example by scheduled back-ups
17:38:55FromGitter<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:57PMunchYou don't want something installing a system service that constantly leaks your data for example
17:39:37*Jesin joined #nim
17:40:07Araqwhat's special about a system service? clang could easily send my homedir to some server without me noticing
17:40:35PMunchYeah, and to install clang you would need to authorize it through sudo
17:40:43Araqjust admit there is no "security" concept for desktops to speak of :P
17:41:04AraqI can install clang without 'sudo', in fact that's how I install 'nim' ...
17:41:05FromGitter<Varriount> PMunch: Not if clang get's installed to the home directorie's bin
17:41:23PMunchHmm, that's true
17:41:35PMunchBut then you would have to launch it manually.
17:41:42*nhywyll joined #nim
17:41:43PMunchIt wouldn't just automatically start
17:43:59Araqwhen 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:56FromGitter<Varriount> Araq: Sandboxing
17:46:37PMunchBut would you be able to rename files Araq? Or do you plan on identifying file-types on the fly?
17:57:41AraqPMunch: renaming is allowed but file extension renames wouldn't be allowed for most apps
17:58:16PMunchWhat about downloads? Downloading a file that has .cpp extension but is actually a .png?
17:58:25PMunchOr file creation for that matter :P
17:59:07Araqso chrome and curl can create filenames of arbitrary extension but not read them :P
17:59:42Araqa .png that is named .cpp is a .cpp file.
18:02:24AraqPMunch: "it wouldn't automatically start" is not that helpful on a laptop where nothing gets restarted all that often
18:04:32dom96I love how my talk has such a high amount of views relative to others from NI dev conf heh
18:04:55dom96Btw I think I am much better off recording something in the peace and quiet of my home
18:05:09LyndsySimondom96: link?
18:05:33dom96I'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:40dom96https://www.youtube.com/watch?v=4D2ryw7tyBA&t=201s
18:05:47dom96https://www.youtube.com/watch?v=4D2ryw7tyBA
18:09:10LyndsySimonI'm probably going to PyOhio next month; I might put together a quick lightning talk about Nim.
18:09:32shmupwhere at in ohio?
18:09:33LyndsySimonComparing Nim's types to Python's type annotations would probably be a good way to get people interested and exposed to it.
18:09:37LyndsySimonColumbus.
18:09:52shmupcool. i lived there briefly (and cleveland). from findlay tho
18:09:53dom96LyndsySimon: Awesome. Sounds like a good plan.
18:10:36LyndsySimonI'm originally from Arkansas, but have been in Virginia for the last four years.
18:10:50FromGitter<ephja> are 0 length arrays supposed to work? if so, should [] work?
18:11:22PMunchArrays?
18:11:36PMunchWhy would you want a 0 length array?
18:12:06federico3the concept of user privilege separation exists in many OSes and devices and predates Unix https://en.m.wikipedia.org/wiki/Superuser
18:12:22FromGitter<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:44FromGitter<Varriount> Oh wonderful: https://github.com/arvidn/libtorrent/issues/2111#issuecomment-312051030
18:15:18FromGitter<ephja> booooooo!
18:17:36Araqit should work, empty arrays are used throughout the compiler
18:19:14PMunchVarriount, ouch
18:21:04FromGitter<Varriount> Nim is great at interfacing with C. C++ is a different beast though
18:23:42Araqit is great at c++, considering the competition and how hard it is to do
18:25:42*Sentreen joined #nim
18:27:27shashlickAraq: have submitted issue after additional tests. https://github.com/nim-lang/Nim/issues/6031
18:30:25FromGitter<Bennyelg> Hey how to upgrade Nim
18:30:46PMunchBennyelg, how did you install it?
18:30:58Araqshashlick: already replied
18:31:46shashlickAraq: I see what you are saying
18:32:02shashlickBut why can't i force the GC to clean up?
18:32:22FromGitter<Bennyelg> if I remember correctly: sh build.sh ⏎ bin/nim c koch ⏎ ./koch tools
18:32:40dom96Bennyelg: consider using choosenim for this
18:32:46Araqthe GC has no chance, these things are still alive
18:33:49AraqGC_collect does not mean "nuke the memory", it still has to adhere to some rules.
18:34:13shashlickBut shouldn't they get cleaned up when you return to parent? Cause i see sibling directories adding up as well
18:35:02shashlickRegardless, i don't understand it well enough to argue, will try to change the logic
18:35:27shashlickWill it help if the read happens in a spawned thread?
18:35:35FromGitter<Bennyelg> What is going on with jester web framework, is it going to be upgraded soon? for production use
18:35:46Araqshashlick: yes that can help too but seems overkill
18:35:58shashlickOk will try thanks
18:36:19shashlickShould I close the issue or leave it
18:37:21FromGitter<Varriount> @Bennyelg What do you mean?
18:37:59FromGitter<Bennyelg> I mean, I can relay on this framework to work on stressfull system? with a lot of requests ?
18:38:34Araqshashlick: I need to investigate further. will close it afterwards. this is just my hypothesis
18:41:11dom96bennyelg: yes. The forum has been running in production for years now.
18:41:23dom96irclogs.nim-lang.org is also served via jester
18:41:35dom96Have you ever seen it down?
18:41:41dom96I sure haven't
18:41:41FromGitter<Bennyelg> nop :)
18:42:10FromGitter<Varriount> @Bennyelg That being said, I believe nginx is recommended as a front-end (for SSL and other goodies)
18:42:31FromGitter<Bennyelg> I building a loadindex service which needs to handle around 10k requests per minute
18:42:32PMunchI've also used Apache as a reverse proxy for Jester, works great
18:43:31*yglukhov joined #nim
18:43:44FromGitter<Varriount> @dom96 Has the forum ever been stress-tested with that kind of load?
18:43:49Araq10K req/s should be fine
18:43:54Araqiirc
18:43:58dom96It was on HN
18:44:01shashlickAraq: 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:02dom96multiple times
18:44:12dom96It was absolutely fine
18:44:31AraqHN doesn't cause 10K req/s
18:44:41dom96Of course it doesn't.
18:44:51dom96But it still kills many sites
18:45:07dom96I've seen a blog article return a 504 just yesterday because it was on HN
18:45:22FromGitter<Bennyelg> Well, I'll run a nice POC and let you know about it and what is the latency we got
18:45:25PMunchThe classic hug of death :P
18:46:38FromGitter<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:12FromGitter<Varriount> @Bennyelg Don't forget to compile with -d:release and link-time optimizations
18:48:26AraqBennyelg: I optimized the forum heavily. by tweaking the sqlite schema (missing indexes). jester/nim had nothing to do with the slowness
18:48:38Araqwell ok, not "heavily"
18:48:57Araqbut it got slower and slower until I fixed the schema.
18:49:14*yglukhov joined #nim
18:49:25FromGitter<Bennyelg> Ok but this is nothing todo with jester it's a DB issues :)
18:50:05Araqyeah sure. but I blamed jester :P
18:50:20FromGitter<Bennyelg> Oh heheh
18:50:52dom96Bennyelg: still working on it, sorry
18:51:51*v17d quit (Ping timeout: 240 seconds)
18:52:59FromGitter<Bennyelg> :) Maybe we will get some Bonos chapters :P
18:57:17*aerx joined #nim
18:58:11*salewski joined #nim
18:58:35shashlickIs it possible to convert a raw buffet
18:58:59shashlickUgh, raw buffer into a string without a copy
19:02:28FromGitter<Varriount> shashlick: Is the buffer tracked by the GC?
19:02:53shashlickNo, alloc()
19:02:56*vivus quit (Quit: Leaving)
19:03:31FromGitter<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:39FromGitter<Varriount> shashlick: Why do you need a string structure?
19:06:06*tankfeeder joined #nim
19:06:11shashlickVarriount: 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:52shashlickrather than having to rewrite the entire algorithm
19:07:21*tankfeeder left #nim (#nim)
19:08:40subsetparkdom96: 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:09FromGitter<singularperturbation> IIRC, jester is async (think event loop)
19:10:11*dexterk_ quit (Quit: Konversation terminated!)
19:10:23*dexterk_ joined #nim
19:10:33FromGitter<singularperturbation> so it's single-process but can handle multiple requests if doing non-blocking I/O (not CPU-bound)
19:10:47FromGitter<Varriount> shashlick: I don't know why we have that module. SHA-1 is broken.
19:10:49FromGitter<Varriount> https://en.wikipedia.org/wiki/SHA-1
19:11:13subsetparksingularpertubation, yes - unfortunately the work i'm doing is CPU bound
19:11:31FromGitter<Varriount> subsetpark: Spin off worker threads to do the heavy lifting?
19:11:33FromGitter<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:39subsetparkVarriount - seems like it
19:14:05subsetparkWith 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:21shashlickVarriount: 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:38FromGitter<Varriount> shashlick: https://github.com/nim-lang/Nim/issues/6031 - Araq says that the recursion is what's causing the memory leak
19:15:41FromGitter<Varriount> If you need to, remove the reference to the string from the stack, or explicitly overwrite it with a smaller string
19:16:21FromGitter<Varriount> Araq: Does setLen(0) free up memory?
19:17:13shashlickVarriount: 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:18shashlickOh that's an idea
19:18:44dom96subsetpark: you want parallelism
19:18:51dom96async only gets you concurrency
19:19:04subsetparkyeah
19:21:48shashlickSetting string to a shorter value doesn't release the memory
19:21:54FromGitter<Varriount> Eeew
19:22:06salewskiVarriount, I am nearly sure setLen(0) will not free memory. Because generally we want to reuse memory.
19:22:24FromGitter<Varriount> shashlick: Do ` = ""` then
19:22:26salewskiMaybe we should have setLen(-1) to free mem.
19:22:49shashlickThat didn't work
19:22:58shashlickSetlen also didn't work
19:23:32subsetparkdom96 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:34FromGitter<Varriount> shashlick: Any reason you can't use the builtin hash module - https://nim-lang.org/docs/hashes.html ?
19:23:45dom96subsetpark: ^flowVar
19:23:56FromGitter<Varriount> Won't that block though?
19:24:01dom96We need to unify this FlowVar stuff with Future
19:24:06dom96yes, it will.
19:24:36subsetparkso, how do i read it without blocking the main thread?
19:24:52shashlickVarriount: 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:21dom96subsetpark: 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:46FromGitter<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:49dom96I will also make this type of thing much easier to do, because it comes up incredibly often.
19:27:01dom96But basically you have to poll the FlowVar
19:27:20dom96when you're polling asyncdispatch
19:27:47subsetparkdom96: yes, I remember that line! So I assume isReady yields inside an async context?
19:27:50FromGitter<Varriount> shashlick: What are you doing again? And why does it require recursion?
19:28:04dom96subsetpark: nope
19:28:26subsetparkoh, is that the .poll() call at the bottom? I can't tell what scope it's in
19:28:37dom96This code isn't inside any async context
19:28:40dom96it's just normal Nim code
19:28:54dom96You should read my book ;)
19:29:05*bahtiyar_ joined #nim
19:29:56shashlickVarriount: 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:42shashlickVarriount: basically I'm recursing through a directory of files, looking for duplicates.
19:30:55subsetparkdom96: be that as it may, my code is in a jester route, so it's async by definition
19:31:24dom96subsetpark: You won't be able to put it in there I'm afraid
19:31:27FromGitter<Varriount> shashlick: You don't need recursion for that.
19:31:30dom96you'll need to use a global variable or something
19:31:43dom96You can't poll the async dispatcher inside an async procedure
19:31:53subsetparkoh jeeze :/
19:32:00subsetparkI can't just yield if it's not ready?
19:33:29shashlickVarriount: 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:58dom96subsetpark: hrm, actually that might work
19:34:24dom96but put a sleepAsync in there.
19:34:52dom96otherwise it will busy wait constantly and not let any other code run in your main thread
19:34:55FromGitter<Varriount> shashlick: Again, I think setLen() should decrease as well as increase memory (perhaps with a flag or something).
19:36:23shashlickI tried with 0 and it didn't
19:38:38FromGitter<Varriount> shashlick: Sorry, I meant, "I think setLen() should be changed so that it decreases memory too"
19:38:47subsetparkdom96 https://www.irccloud.com/pastebin/S8jb5BrV/
19:39:19shashlickOh ok
19:39:23dom96subsetpark: await instead of asyncCheck
19:39:40dom96'await' == 'yield'
19:39:49subsetparkoh right, forgot that
19:40:17dom96hrm, if this works then it would actually be pretty easy to create an 'await' for FlowVars
19:40:35FromGitter<Varriount> shashlick: Oh, try this: https://nim-lang.org/docs/hashes.html#hashData,pointer,int
19:40:37dom96It's not very efficient of course, but we can optimise it later
19:40:53FromGitter<Varriount> shashlick: Memory map the file and then use hashData on the contents
19:40:57subsetparkdom96: looks like it's working; the only thing is, how to check for exceptions?
19:41:50dom96Ugh, wish Araq didn't reuse 'await' for a blocking read of the FlowVar...
19:41:50FromGitter<Varriount> shashlick: You'll want to call close() though
19:42:18dom96subsetpark: good question. I'm not sure, test it.
19:42:29dom96Hopefully `^` raises the exception
19:43:33shashlickWill try it Varriount
19:43:59FromGitter<Varriount> shashlick: Hrm, also, the memfiles module isn't 100% memory safe.
19:44:12shashlickWhat algorithm does hashes use
19:44:28FromGitter<Varriount> The memfiles type is an object, and there's no finalizer/destructor
19:48:55shmupftsf: just curious, why no textHeight? :P
19:51:40shashlickVarriount: is fread() slower than memfiles?
19:52:55FromGitter<Varriount> shashlick: Yes. Possibly.
19:57:36PMunchHmm, speaking of C APIs and such (from earlier). Have anyone had any luck in writing a C API in Nim?
19:58:00FromGitter<Varriount> PMunch: I don't know if anyone has tried.
19:58:40FromGitter<Varriount> PMunch: The biggest difficulty I can think of when using Nim for a C API is starting up the garbage collector.
19:59:16PMunchI did find this: http://gradha.github.io/articles/2015/01/writing-c-libraries-with-nim.html
19:59:30PMunchYeah, that would probably be pretty odd..
20:00:27*bahtiyar_ quit (Ping timeout: 240 seconds)
20:00:47FromGitter<Varriount> PMunch: But plenty of libraries have an initialization route that needs to be called first.
20:05:39FromGitter<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:47Araqvarriount: yes, it would be ridiculous IMO :-)
20:08:02Araqyou write to a pointer that writes through to the hard disk (conceptually)
20:08:12Araqthat's as unsafe as you can get
20:10:30shashlickVarriount: hashes only gives me a numeric value, won't be unique for file contents to identify duplicates right?
20:11:18FromGitter<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:56Araq'when nimvm' iirc
20:12:18Araqbut it's a bit restricted grep for it please to see how it can be used
20:12:43FromGitter<Jeff-Ciesielski> :+1:
20:13:19FromGitter<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:15subsetparkdom96: how can I tell nimble to call `--threads:on` in `nimble build`?
20:32:27*Jesin quit (Quit: Leaving)
20:32:38dom96add to .nim.cfg
20:34:35subsetparkso i add a myproject.nim.cfg file with the flags to pass to the nim compiler?
20:34:38FromGitter<Varriount> shashlick: That's what a SHA-1 hash is too.
20:35:26subsetparkinteresting...
20:35:32FromGitter<Varriount> shashlick: Compare the length and hash of the file, and you shouldn't get any collisions
20:36:19FromGitter<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:09FromGitter<ephja> subsetpark: yes, <project>.nim.cfg or nim.cfg
20:52:04demi-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:35dom96demi-: what's the error?
20:56:30demi-one sec and i can grab them
21:00:02demi-dom96: http://magic.pewpewthespells.com/2I3m0O2i0f2a
21:01:34demi-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:34dom96"Building from latest C sources. They may not be compatible with the Nim version you have chosen to install."
21:01:43FromGitter<Varriount> Araq: I would prefer memory safety and a higher-level interface, much like Python's mmap module.
21:01:48dom96I'm guessing the C sources were updated
21:01:55dom96and so are not compatible with 0.16.0 :\
21:02:19demi-aren't the C sources tagged with releases so i can download those versions?
21:02:27dom96nope
21:02:30demi-D:
21:02:46dom96hrm, I guess they're hosted on the website though
21:03:26*bjz joined #nim
21:03:45demi-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:17dom96I 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:28demi-i'd be up for doing either, but atm i just want things to work
21:04:41dom96Yeah, I understand. Sorry :\
21:04:58dom96What you can do as a workaround is: choosenim 0.16.0
21:05:00FromGitter<Varriount> Noooo, not NimYAML
21:05:19demi-dom96: yeah i tried that but i am unable to use nimble
21:05:20dom96cp ~/.choosenim/toolchains/nim-{0.17.0,0.16.0}/bin/nimble
21:05:32dom96(path might be a bit different)
21:05:40demi-and i'm not sure why i cannot use nimble
21:05:47demi-Varriount; indeed :(
21:05:47*Jesin joined #nim
21:06:21dom96Araq: Isn't breaking yaml a pretty big deal? Is this fixed in devel? Can we release 0.17.2?
21:06:44Araqdom96: told zahary to fix it
21:06:46demi-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:55dom96demi-: heh :)
21:07:04AraqI agree with you, it warrants a 0.17.2
21:07:26demi-and tbh choosenim has been fantastic apart from this one hickup in building 0.16.0
21:08:16dom96yay, thanks :D
21:08:44dom96I wonder what else I could do. Maybe a switch to install latest Nimble with older Nim would be better
21:08:58dom96Then I can suggest its use, instead of the installation of #v0.16.0
21:09:53dom96We have asked zahary to fix the yaml issue tomorrow :)
21:10:04demi-cool; thanks!
21:10:18Araqvarriount: what do you mean by "memory safety"?
21:10:44subsetparkflags-wise, does `nimble install` do anything more clever than -d:release ?
21:10:46Araqhow can Python make memory mapped files "safe"? as I said, its nature is completely unsafe
21:11:13dom96Anyway, 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:58mwbrownQuestion for you guys: What is the preferred way of communicating between threads created using the threadpool spawn?
21:12:25mwbrownI 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:32Araqmwbrown: you don't really communicate, you spawn a task, it returns, that's it.
21:14:54mwbrownok. So if I have a producer/consumer thread model it needs to use traditional threads?
21:15:03mwbrownAnd threadpool is more for a run-to-completion async/await type deal?
21:15:28Araqthreadpool is about parallelism it's not for concurrency.
21:15:38dom96I'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:38mwbrownAraq: 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:29shmupftsf: 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:05FromGitter<Varriount> Araq: Python unmaps the memory on object collection, uses string-like subscript operators for access, etc
22:54:26Araqsafety about forgetting a 'close' call is not memory safety.
22:54:44Araqa 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:49PMunchHmm, is there a way to make Nim coerce non-varargs arguments?
23:42:25PMunchWith varargs you can do "proc something(things: varargs[string, '$'])"
23:42:39PMunchCan the same be achieved without varargs?
23:44:19FromGitter<zacharycarter> I think that's what converters are for
23:44:38FromGitter<zacharycarter> *think*
23:45:03PMunchConverters are global though..
23:45:08PMunchI want this for only one proc
23:45:52FromGitter<zacharycarter> gotcha
23:47:08FromGitter<zacharycarter> I don't think so
23:47:27FromGitter<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)