<< 11-02-2017 >>

00:04:18*bjz joined #nim
00:06:04*devted quit (Quit: Sleeping.)
00:06:16*nsf quit (Quit: WeeChat 1.7)
00:21:26*carterza joined #nim
00:33:02*vlad1777d quit (Remote host closed the connection)
01:00:37*chemist69 quit (Ping timeout: 256 seconds)
01:03:30*chemist69 joined #nim
01:10:58*xet7 quit (Quit: Leaving)
01:48:56*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
02:03:09*gangstacat quit (Quit: Ĝis)
02:03:29*krux02 quit (Ping timeout: 240 seconds)
02:04:30*chemist69 quit (Ping timeout: 245 seconds)
02:18:37*chemist69 joined #nim
02:48:17*allan0 quit (Ping timeout: 256 seconds)
02:49:44*eizua joined #nim
02:52:45*allan0 joined #nim
02:56:26FromGitter<martinium> anyone know of a rss lib for Nim with documentation?
02:56:37FromGitter<martinium> I found one called nim-rss but doesn't have any documentation
03:02:34*chemist69 quit (Ping timeout: 240 seconds)
03:15:49*rauss joined #nim
03:16:38*chemist69 joined #nim
03:35:21*cjbest joined #nim
03:44:02*yglukhov joined #nim
03:49:18*yglukhov quit (Ping timeout: 276 seconds)
03:55:41shashlickI've been trying libcurl.nim and while it builds, it doesn't seem to run
03:56:11shashlickcould not load: libcurl.dll
03:56:11shashlick - Error: execution of an external program failed:
03:56:41shashlickat least the version of libcurl.dll bundled nim doesn't seem to work
04:17:30shashlickhttps://nim-lang.org/docs/libcurl.html => 404
04:29:08*brson quit (Quit: leaving)
04:35:03*cjbest quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
04:36:06*sz0 joined #nim
04:55:23FromGitter<rosshadden> I have a `c2nim` question. Given the following two lines in a header file: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=589e9939f045df0a22326184]
04:59:30*yay quit (Quit: yay)
04:59:34FromGitter<rosshadden> Do you know, @gokr? Your blog post on this was a great resource.
05:03:31*Jesin joined #nim
05:03:40*chemist69 quit (Ping timeout: 245 seconds)
05:20:47carterzaI need to wrap - https://github.com/jarikomppa/soloud
05:23:04carterzaI’m running into some problems - https://gist.github.com/zacharycarter/5313dd425a7f570172ecf6f6de73305b#file-gistfile1-txt-L61
05:23:54carterzaI don’t understand the error, even if I add an empty struct for the type, I still get the same error
05:30:37carterzaah nm
05:30:44carterzastupid me. it’s late...
05:30:50*chemist69 joined #nim
05:36:18*eizua quit (Remote host closed the connection)
06:22:00*tankfeeder joined #nim
06:22:56*rauss quit (Quit: WeeChat 1.7)
06:38:06*chemist69 quit (Ping timeout: 252 seconds)
06:46:41Araqshashlick: 32 vs 64 bit problem?
06:47:11shashlickI am using libcurl.dll in the nim folder itself
06:47:45shashlickcopied it over to my exe dir
06:49:40carterzasweet
06:49:54carterzaI have https://github.com/jarikomppa/soloud wrapped now
06:56:41*chemist69 joined #nim
06:56:49Araqshashlick: yes, the installer likely got it wrong
06:57:12Araqthat's why most DLLs have <bits> attached
07:02:25shashlickya, actually I installed the x64 version via the installer but it was unable to install the DLLs so I copied those over from the x64 ZIP file
07:02:44shashlickthe ZIP includes 32 and 64 bit versions of all DLLs but libcurl has only one DLL
07:40:03Araqthat pretty much means libcurl is not supported :P
07:42:53*bjz joined #nim
07:46:05*yglukhov joined #nim
07:47:55*Vladar joined #nim
07:48:41*tankfeeder quit (Ping timeout: 240 seconds)
07:50:19*yglukhov quit (Ping timeout: 256 seconds)
07:55:00shashlickI just tried building a 32bit version of my app with mingw32 and 32-bit version of Nim but this time, it just crashes with libcurl
07:55:17shashlickThis application has requested the Runtime to terminate it in an unusual way.
07:55:17shashlickPlease contact the application's support team for more information.
07:55:17shashlickNo stack traceback available
07:55:17shashlickSIGABRT: Abnormal termination.
07:55:44*nsf joined #nim
07:56:53shashlickAraq: the libcurl.dll packaged with Nim, was it built along with Nim or downloaded from elsewhere? I'm not able to find a DLL version of libcurl that's not for cygwin
08:08:05shashlickokay I found a version of libcurl that is working, so just the dll is bad
08:08:37*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
08:24:05FromGitter<Varriount> @rosshadden Integers are not implicitly convertible to pointers
08:28:49Araqshashlick: thanks for reporting, will remove this DLL then
08:29:00*yglukhov joined #nim
08:31:21*yglukhov quit (Remote host closed the connection)
08:36:31*rokups joined #nim
08:41:48Araqvarriount: awaiting your finish PR ;-)
08:47:32*hjsagg joined #nim
08:50:05*bjz joined #nim
08:55:29Jipok[m]Hi everybody. I can't register on the forum. It asks:
08:55:34Jipok[m]What is 969+1?
08:55:47Jipok[m]all time
08:55:56Xecan you add?
08:56:04Jipok[m]I answer: 970
08:56:24Jipok[m]and i get "Error: Answer to captcha incorrect! "
08:56:43Xeclear your cookies and try again?
08:57:15Jipok[m]already tried
08:57:35Xetry from the tor browser?
08:57:42Jipok[m]I also tried to use private mode and a different browser
08:58:12Jipok[m]not from tor
08:58:41AraqJipok[m]: you're a bot? ;-)
08:58:47Araqtry to get a different captcha
08:59:29rokupsAraq: need guidance. what do i do to make coroutines support yelding in try/except blocks?
08:59:41*gokr joined #nim
09:00:12Araqrokups: good question. try is either mapped to setjmp or C++ exceptions
09:00:26Jipok[m]Araq: how? it asks me all the time 969 + 1
09:01:24Araqboth mechanisms put something on the stack, rokups. you switch stacks properly, it works out of the box?
09:01:57rokupssomehow it doesnt. i thought maybe there is some magic like with stack frames that needed explicit handling
09:02:30*yglukhov joined #nim
09:02:41AraqJipok[m]: clean cookies and get a fresh IP and retry
09:03:00Araqfor me it asks 5+145, for instance
09:03:16rokupsone coroutine after cathing exception exits proper, another dies with "stack smashing detected".
09:03:32Araqalso it overlays 2 numbers, maybe you misread the numbers?
09:04:03Araqonly blue digits matter
09:04:50Jipok[m]I made it through a proxy.
09:05:14Araqshow me screenshot please
09:05:18Jipok[m]it worked
09:05:22Araqfrom the captcha
09:05:26Araqah ok.
09:05:40rokupsAraq: there is thing called `currException`, doesnt that need to be preserved somehow?
09:05:54Araqrokups: it's a thread local
09:06:17*yglukhov quit (Remote host closed the connection)
09:06:18rokupsAraq: but coroutines run on same thread and try/except blocks may overlap so to speak if suspend() is called in them
09:06:53Araqhmm yeah, that's a problem then
09:07:18Araqtry C++ mode first, maybe C++ gets it right?
09:07:28rokupskk
09:09:16Araqthe thread local currException needs to become "coroutine" local, right. tough nut, but you can do that in your 'swapStack' op
09:10:01shashlickTried to build libcurl as a static library but program crashes
09:10:16rokupsyeah, just like with stack frames. cpp doesnt even compile heh. doesnt like my importc'ed apis.
09:10:20shashlicknim c --dynlibOverride:libcurl --passL:libcurl.lib program.nim
09:12:35shashlickwell, looks like libcurl.nim is written as a dynlib only
09:12:43*yglukhov joined #nim
09:14:28Jipok[m]Can you help me? I used the code sample from githab.
09:14:29Jipok[m]https://github.com/nim-lang/ui
09:14:37Jipok[m]But it does not work for me. The output of the compiler here:
09:14:37Jipok[m]http://pastebin.com/zZaW1KB2
09:14:58*yglukhov quit (Remote host closed the connection)
09:16:54AraqJipok[m]: for some reason a newline is in the GCC invocation?
09:17:00shashlickI need a libcurl.a for Windows, not a .lib
09:17:26Araqshashlick: just use httpclient instead. I know it sucks, but dom96 is working on it.
09:17:44*yglukhov joined #nim
09:17:52shashlickman reason for curl is SSPI to punch through an NTLM proxy
09:18:24AraqI don't know what that means, so it must be a bad idea.
09:18:45Jipok[m]Araq: idk. I just called "nim c sample.nim"
09:19:04AraqJipok[m]: worked on my ubuntu, but I have an idea
09:19:38Jipok[m]fedora 25
09:20:09Jipok[m]can offer to try anything?
09:21:36Araqjust a sec
09:21:49*yglukhov quit (Ping timeout: 240 seconds)
09:22:42AraqJipok[m]: try most recent master please
09:23:12rokupsAraq: saving and restoring (framePtr, excHandler, currException) when switching context worked ^_^
09:23:34Araqrokups: :D good job
09:23:53AraqI think these are the only ones that need to be saved
09:23:58rokupsdid you check out https://github.com/nim-lang/Nim/compare/devel...rokups:feature/coroutines2?expand=1 ? any objections?
09:24:16Araqwell you removed the old Registers stuff
09:24:24Araqnot sure that's valid
09:24:45Araqbetter be safe than sorry when it comes to GC stack scanning
09:25:07rokupswell.. main stack is still scanned like all coroutine stacks so that buffer should end up scanned i think
09:25:16rokupsif it is scanned it should be good right?
09:25:49rokupsi can try debugging in IDA if its picked up by gc
09:26:03Araqyes, but I cannot review this, it needs to be tested somehow
09:26:19rokupsdo we have any gc stress tests available?
09:26:33Araqwell we have tests/gc
09:26:55Araqand some stress test that I dunno where it ended, it runs for so long we had to disable it
09:27:07rokupsbtw whats your stance on using ucontext.h?
09:27:31AraqI don't like this move to OS specific APIs, inline assembler is way cooler
09:27:48rokupsits not exactly os-specific. its posix
09:27:49cheatfateAraq, we don't have resources to maintain assembly code for all platforms
09:27:59Araqbut by now you know more about these things than I do
09:28:05Araqso I trust your judgement.
09:28:20Araqcheatfate: so make the OS specific stuff a fallback
09:28:39Araqinline assembler means we avoid context switches
09:28:51Araqwhich is kind of the point of this.
09:29:02rokupserr wut? setjmp does not perform context switch
09:29:06Araqwell not *the* point, but one point.
09:29:06rokupsit just dumps registers
09:29:14rokupslongjmp does context switch
09:29:57Araqwell Windows fibers at least mean the kernel is involved, so user<->kernel context switch
09:30:07cheatfateAraq, fibers are userspace
09:30:08rokupsnooo its not
09:30:20rokupsfibers just meddle with TEB or something, totally userspace
09:30:23rokupsthats the whole point
09:30:51cheatfateucontext for posix and fibers on windows are all userspace, no kernel involved
09:32:04rokupsi dont like apple/posix deprecating ucontext, but i think we can be sure at least linux will not remove them. even if apple yanks ucontext it is probably still easier to maintain support for 3 OS at source code level than X architectures at assembly level
09:33:16rokupsby the way speaking of fibers - if you inspected that coroutines2 branch - it uses undocumented Fiber struct on windows to get allocated stack start and end, cool stuff :p picked it up from reactos and verified debugging on windows ;)
09:33:44Araqok, I misunderstood these APIs then
09:33:56Araqalso this C++ exception stuff is convincing
09:34:28Araqwe don't know what thread local stuff it uses, but the OS has some chance of knowing
09:34:51Araq„On a somewhat historical note, the real reason we added fibers was not to give people control over their threads. Heck, it’s your thread, you’ve got control, just allocate some memory for a stack then set ESP to point to it. Lots of people tried this, but it’s not quite that simple. There are a lot of subtleties to get wrong. For instance, they would switch the stack base, but not update the stack limit. Or not switch the exception handler list
09:34:51Araq. Or forget to swap the FP state. And down the line these little gotchas would bite them in some subtle unforeseen way.
09:34:51AraqSince people kept getting it wrong (and in fact, it was not possible to get it right without doing some fairly undocumented stuff) and causing untold grief, we figured it was time to build it into the OS and let everybody use.“
09:34:59Araqfrom https://blogs.msdn.microsoft.com/larryosterman/2005/01/05/why-does-win32-even-have-fibers/
09:35:50*carterza quit (Quit: carterza)
09:36:31Jipok[m]Araq: http://pastebin.com/mrCuy94F
09:36:46AraqJipok[m]: use nim devel
09:37:13Jipok[m]arrr
09:38:14rokupsnow i wonder what will happen using cpp exceptions on unixes
09:38:38rokupsi have no idea how exceptions work in c++ on non-windows, just vaguely familiar with windows stuff even
09:38:55Araqbbl
09:39:48Jipok[m]Araq: you wrote: "Jipok[m]: try most recent master please"
09:40:46*Matthias247 joined #nim
09:41:15*Trustable joined #nim
09:41:49Jipok[m]before that I used devel
09:49:08*hjsagg quit (Ping timeout: 255 seconds)
09:52:20dom96Jipok[m]: he probably means most recent master of the ui repo.
09:53:18*gokr quit (Ping timeout: 276 seconds)
09:55:21Jipok[m]ah< ok
10:01:58Jipok[m]http://pastebin.com/KwwzyWJj
10:02:31Jipok[m]Nim Compiler Version 0.16.1 (2017-02-11) [Linux: amd64]
10:03:24*tankfeeder joined #nim
10:16:38FromGitter<Varriount> rokups: Eh, we really shouldn't use undocumented APIs
10:17:05rokupsVarriount its best we got, and its not going to change anyway so its cool ;)
10:17:20Jipok[m]maybe I'm wrong set nim? nimx not work for me, too.
10:17:21Jipok[m]http://pastebin.com/R6uJbNbj
10:17:43FromGitter<Varriount> Rokups: Couldn't we use a marker variable, and take the address of it?
10:19:13rokupsgc needs both ends of the stack. if we were getting stack address that way we would have no way to get other end of the stack precisely. all we could do is guess because we know stack size we requested, but it is still a guess. and undocummented api that is stable is better than guess that will eventually lead to a crash ;)
10:19:57rokupsi dealt quite a bit with undocumented windows internals in the past, they arent changing. all microsoft is doing is adding on to end of structs, not introducing random members in the middle. trust me ;)
10:20:30*Vladar quit (Read error: Connection reset by peer)
10:20:42FromGitter<Varriount> rokups: But the stack end is stored in a register, right?
10:21:35FromGitter<Varriount> And the stack start can be calculated by using a marker variable, which is what the scanning gc does for the main stack.
10:21:39rokupsits not precise end since we are already executing and stack was already manipulated
10:22:42rokupseven if we check that variable very first thing in coroutine just started it will not be at very end. some stuff will be pushed on the stack
10:23:00rokupsit gets even more messy between different build configs and optimizations
10:23:17rokupssome stuff may go on stack in debug but not be there in release and so on
10:23:57rokupsbut hey - if you prove me wrong and deliver a proc that can get exact stack ends upon execution ill take it immediately as a proper solution :p
10:24:26FromGitter<Varriount> Fine. But I don't like it - using undocumented internals leads to headaches for everyone when things need to/have changed.
10:24:49cheatfateVarriount: using undocumented api on windows is not so big sin as you think...
10:24:59cheatfateeverybody uses it
10:25:29FromGitter<Varriount> https://blogs.msdn.microsoft.com/oldnewthing/20031223-00/?p=41373/
10:25:41rokupsthere probably is bigger chance for api to get removed entirely than for undocumented structs to be changed in the middle
10:26:35cheatfateVarriount i dont see here any changes to TEB/PEB
10:27:06cheatfateeven windows fibers api uses undocumented TEB
10:27:08Jipok[m]Araq: Should I create a theme with my problem on the forum?
10:27:09rokupsVarriount that article describes accessing something that is not even exposed. it is totally different thing and indeed unsafe.
10:27:32cheatfatetry to look at windows headers macro GetCurrentFiber()
10:27:45cheatfateit uses undocumented TEB
10:30:18cheatfateand you know what PEB/TEB structures have not changed from windows 2000
10:30:30FromGitter<Varriount> Ugh, fine, I'll be silent.
10:31:08FromGitter<Varriount> But if things ever do break due to an OS change, I reserve the right to say "I told you so"
10:31:58rokupswill remind you of that in 10 years if we both are still around here :)
10:33:01cheatfateVarriount the only way when microsoft breaking something undocumented it always tries to document it properly, also if TEB/PEB will be changed this information will appears in net just because AV authors reveal it while testing technical preview windows versions
10:34:13rokupsi should mention we do not even access TEB or PEB, but a struct returned by fiber api as raw pointer. thats pretty old feature, idk what they should do to break struct layout
10:35:03dom96Varriount: This channel is logged for precisely these moments, save this link somewhere https://irclogs.nim-lang.org/11-02-2017.html#10:31:08 :)
10:36:01FromGitter<Varriount> Rokups: Changing the alignment of structures? Turning packing on?
10:36:26FromGitter<Varriount> What about different architectures? Wouldn't alignment be different on them?
10:36:30rokupsnow that would be a backwards compatibility disaster for an OS
10:37:18rokupsstruct is defined in nim, not like we use raw offsets. it would likely work on arm as well
10:39:01rokupsstill if anyone can come up with a way to obtain prcisely both stack ends without using that stuff then it would indeed be a proper solution. idk how to do that though
10:42:27FromGitter<Varriount> rokups: What do you mean by stack end - the end of all the data located by the current call stack?
10:42:45*Vladar joined #nim
10:43:29FromGitter<Varriount> Would it be ok for the calculated end to be greater than the actual end?
10:44:07*yglukhov joined #nim
10:44:18rokups suppose we got char stack[0x1000]; upon start of coroutine SP is set to somewhere at stack[0xFD0] or so. we need to know &stack[0] so gc does not scan past it
10:44:54rokupsSP + 0x1000 would indeed go past it. i would say it is unsafe
10:45:06rokupsSP - 0x1000 that is
10:47:10FromGitter<Varriount> So how does Windows calculate/know the end of the stack, if it's always changing?
10:48:34rokupsCreateFiberEx API allocates stack, thats how its known. there is nothing to calculate as exact stack ends are stored in that struct.
10:51:11*Sembei joined #nim
10:51:19FromGitter<Varriount> rokups: Ah, so the start and end of the entire region of stack memory (even that which isn't being used) is needed, not just the memory that's being actively used?
10:52:34rokupswell im tracking it all for reasons i dont recall now
10:53:10*Pisuke quit (Ping timeout: 258 seconds)
10:53:29rokupshmm, but now you got me thinking
10:53:31FromGitter<Varriount> Because the scanning GC doesn't need the entire region, just the part that is being actively used
10:54:18rokupsmaybe it indeed would be enough to do &var at coroutine start and scan region between that and current stack top
10:55:15*jh32 joined #nim
10:56:32FromGitter<Varriount> rokups: That's what confused me. You don't want to scan unused memory, as it contains stale values
10:56:57*yglukhov quit (Remote host closed the connection)
10:57:11rokupsyes. well i have no schooling on gc stuff so.. ^_^
10:57:26rokupsand tbh that gc handling for coroutines is broken anyway. it needs to be redone
10:57:45rokupsstill cant bootstrap with coroutines enabled due to crash. something is certainly wrong there
10:58:15FromGitter<Varriount> On a related note, I wonder if large c/c++ programs have run into stack overflow issues with normal call stacks.
10:59:14rokupsnever seen such cases as long as its not recursion gone wild (which is a bug really)
11:02:54rokupsVarriount i read some stuff hinting that at least glibc handles running out of stack as well by allocating more. no idea how that is happening though
11:03:43*nsf quit (Quit: WeeChat 1.7)
11:14:11FromGitter<Varriount> rokups: I know that on Windows, not ask stable memory reserved is actually allocated
11:14:31FromGitter<Varriount> *all stack
11:15:11rokupshmm sounds familiar. CreateFiberEx() allows specifying reserved stack size and commited stack size separately
11:15:31FromGitter<Varriount> Yes.
11:54:50*yglukhov joined #nim
12:02:21*Snircle joined #nim
12:04:56*Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif)
12:09:20*filcuc joined #nim
12:18:15*vlad1777d joined #nim
12:22:41*vlad1777d quit (Remote host closed the connection)
12:25:12*vlad1777d joined #nim
12:26:45*yglukhov quit (Remote host closed the connection)
12:28:15*yglukhov joined #nim
12:29:10FromGitter<gyermolenko> "Nim enters the TIOBE index at position 129 this month."
12:30:30*yglukhov quit (Remote host closed the connection)
12:42:08*yglukhov joined #nim
12:42:32dom96oooh
12:44:03*MyMind joined #nim
12:44:08dom96Pity that it's not even in the top 100 :\
12:45:14*Sembei quit (Ping timeout: 240 seconds)
12:45:41federico3:(
12:45:59dom96I do find it odd that the other new entry (Ring) is 104th
12:47:31dom96but meh, this index likely isn't very accurate.
12:48:38*Trustable quit (Remote host closed the connection)
12:48:52*yglukhov quit (Remote host closed the connection)
12:49:33*Trustable joined #nim
12:52:25*carterza joined #nim
12:53:27dom96yay, streamed downloads now work :D
12:53:39*Trustable quit (Remote host closed the connection)
12:56:46*Trustable joined #nim
12:57:40*nsf joined #nim
13:02:58filcucis there a nimsuggest documentation?
13:03:20*elrood joined #nim
13:03:31dom96https://nim-lang.org/docs/nimsuggest.html
13:03:32FromGitter<zacharycarter> @Varriount you around?
13:03:58FromGitter<Varriount> @zacharycarter Yep!
13:04:02FromGitter<zacharycarter> oh sweet!
13:04:06FromGitter<zacharycarter> got some new stuff to show you - one sec
13:04:36FromGitter<zacharycarter> well first of all, I wrapped - https://github.com/jarikomppa/soloud last night
13:04:44FromGitter<zacharycarter> and got it working with my engine
13:05:41filcucdom96: thank you
13:06:07FromGitter<zacharycarter> starting on 3d - http://imgur.com/a/61Wip
13:06:18FromGitter<zacharycarter> and I got sprite animations working, along with resizing widgets
13:06:26FromGitter<zacharycarter> with scrollbars
13:07:40FromGitter<Varriount> @zacharycarter Oh cool! The sound library looks prefect
13:07:47FromGitter<Varriount> *perfect
13:08:07FromGitter<Varriount> Really hits that sweet spot
13:08:44filcucmaybe someone here already played with nimsuggest..but how do i know that the stream is complete for a request?
13:08:59filcucsuppose i sent through the socket "sug etc...."
13:09:18FromGitter<zacharycarter> mmhmm
13:09:20filcucon the socker i will receive 0 or N lines
13:09:24filcucsocket
13:09:32FromGitter<Varriount> fulcuc: If I recall correctly, it's newline terminated
13:10:33filcucvarriount maybe i'm doing something wrong here, but with my QSocket API if i so m_socket.readLine() i get only on line of sug
13:10:49filcucif do the same with the plain NimSuggest from a console i obtain multiple lines
13:11:06filcuc:|
13:11:54filcucin other words: is the whole reply a single line?
13:11:56FromGitter<Varriount> filcuc: But isn't there a "blank" line that signals end of output?
13:12:29filcucwhere whole reply is made of multiple "sug ....."?
13:12:36FromGitter<Varriount> I didn't design the protocol. If I had, we would have length-prefixed binary output.
13:13:15filcuci agree...or at least with an echo mode (like serial protocol)
13:13:26filcucso i can read until i see my command
13:15:01FromGitter<Varriount> filcuc: The original protocol just cut the connection/exited the process after the suggestion. Let me see what it does now.
13:16:32dom96filcuc: you're comparing apples to oranges
13:16:44dom96if you readLine from a terminal fd then you will also only get a single line
13:16:55dom96Your terminal prints all of them automatically
13:17:04FromGitter<Varriount> https://github.com/nim-lang/Nim/blob/devel/tools/nimsuggest/nimsuggest.nim#L296
13:18:01FromGitter<Varriount> Adds \c\L then closes the connection
13:18:24filcucdo you mean that i can make only one request to a NimSuggest process?
13:19:18FromGitter<Varriount> No, you can only make one request per connection
13:19:21filcucso one request through the socket and then it dies. Correct?
13:19:31filcucVarriount ok
13:19:32FromGitter<Varriount> Yes.
13:19:56filcucSo basically one request and then he close the socket
13:20:02filcuccloses
13:20:05FromGitter<Varriount> Yes.
13:20:23FromGitter<Varriount> Have fun opening a socket on every keystroke
13:20:25dom96I guess you need to reconnect for each request
13:22:15filcucmaybe is should just use stdin
13:22:19filcucand no sockets
13:22:48filcucand connect to the process streams
13:23:09filcucin this way i shouldn't need connect/disconnect the sockets
13:23:09FromGitter<Varriount> Filcuc: I hope you can do threads...
13:23:54filcuc:| or another option is to keep a pool of connections
13:23:58FromGitter<Varriount> Or are targeting *nix only
13:24:20Araqfilcuc: use the EPC protocol then, that has lengths
13:24:29Araqand is what VS Plugin uses too
13:25:09*yglukhov joined #nim
13:25:53FromGitter<Varriount> Araq: How does the VS plugin handle dirty files?
13:26:12Araqit uses them?
13:26:26AraqI dunno what to answer, it uses /tmp
13:26:48FromGitter<Varriount> I mean, if you want suggestions on every keystroke, doesn't that necessitate saving every keystroke?
13:27:00filcucAraq: ok, now it's a compromise of getting the thing done or not..how complex is this epc protocol?
13:27:29filcucotherwise i think that i should just use a pool of connections
13:28:44Jipok[m]filcuc: You can also rewrite nimsuggest to fit your needs. There's not a lot of code
13:28:51Jipok[m]https://github.com/nim-lang/Nim/blob/devel/tools/nimsuggest/nimsuggest.nim
13:30:24*yglukhov quit (Ping timeout: 276 seconds)
13:31:00filcucJipok[m]: thanks for the link...maybe yes, i could..but i hoped to not have to
13:31:39filcuci reality i just wanted to know what is the correct way to integrate it and use it
13:31:57Araqepc is pretty simple
13:32:15Araq16 bit length followed by a Lisp ((tree thingie))
13:33:30Araqer no, 6 byte ascii hex number as the length
13:36:17filcucok
13:36:17Jipok[m]Araq: what's about my problem?
13:36:20Jipok[m]http://pastebin.com/Z2YhZWHn
13:36:47AraqJipok[m]: you need to use my fork of libui
13:36:53rokupsAraq: should gc scan stacks of all coroutines in markStackAndRegisters() or should it scan only current active stack?
13:37:26Araqit needs to scan all stacks
13:37:35rokupsmy guess is maybe active stack is enough provided i put explicit gc collect when coroutine exits?
13:37:40*yglukhov joined #nim
13:38:00rokupsthey all would get scanned anyway. what do you think about that?
13:39:16Jipok[m]Araq: I use your fork
13:39:16Jipok[m]I therefore use your fork
13:39:35Jipok[m]https://github.com/nim-lang/ui
13:43:01Jipok[m]0_o
13:43:02Jipok[m]i wrote this once
13:43:42Jipok[m]matrix sometimes works wonders
13:53:23*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
14:08:33*yglukhov quit (Remote host closed the connection)
14:19:31AraqJipok[m]: my fork is https://github.com/araq/libui
14:19:50Araqrokups: that doesn't work
14:20:00rokupswhy?
14:20:08rokups(just want to understand)
14:20:19AraqGCs are far more complex than that and any incremental steps need to be proven correct
14:20:57Araqif you scan partial heaps, you need some write barrier to ensure correctness
14:21:15AraqI cannot even explain it here in simple terms.
14:22:33rokupsalright then, ill take your word for it ^_^ by the way i fixed that bug which prevented ./koch boot -d:nimCoroutines, but do not ask how
14:22:51Araqhow?
14:23:17rokupsno idea. one thing is clear that this coroutine gc stuff from last year was broken. i reworked that and now it works ;)
14:23:33Araqok, good enough. I hope.
14:23:34Araqbbl
14:24:17rokupswe will see, at least gcbench.nim works, crashed before rework
14:24:30rokupssomething funky going on with my file system, will do more tests when i sort it out
14:34:47*ibk joined #nim
14:37:49Jipok[m]Araq: I think it is necessary to add the information at github: libui should be placed in ~/.nimble/pkgs
14:38:06Jipok[m]it's not obvious
14:40:35Jipok[m]I could understand this only when I saw it
14:40:36Jipok[m]https://github.com/nim-lang/ui/blob/master/ui/rawui.nim#L39
14:47:00*yglukhov joined #nim
14:55:23*gangstacat joined #nim
14:56:47*yglukhov quit (Remote host closed the connection)
14:57:49*Jesin quit (Ping timeout: 240 seconds)
15:00:02*yglukhov joined #nim
15:02:50*elrood quit (Quit: Leaving)
15:04:19*yglukhov quit (Remote host closed the connection)
15:05:15filcucthank you all, cya
15:05:33*filcuc quit (Quit: Konversation terminated!)
15:13:30*cjbest joined #nim
15:14:32*gokr joined #nim
15:21:57*yglukhov joined #nim
15:30:47*Jesin joined #nim
15:39:07*cjbest quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:41:15*nsf quit (Quit: WeeChat 1.7)
15:45:50*cjbest joined #nim
15:46:27*Jesin quit (Quit: Leaving)
15:48:35*Jesin joined #nim
15:50:06*Jesin quit (Max SendQ exceeded)
15:50:31*Jesin joined #nim
15:53:55*yglukhov quit (Remote host closed the connection)
16:02:46*bjz joined #nim
16:02:55*tankfeeder quit (Quit: Leaving)
16:06:00*cjbest quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:06:14*gokr quit (Ping timeout: 240 seconds)
16:07:21*yglukhov joined #nim
16:08:13*krux02 joined #nim
16:12:19*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
16:14:39dom96So me and Araq are discussing https://github.com/nim-lang/Nim/pull/5373
16:15:15dom96Araq suggested aliasing the streams 'write' proc to 'add'
16:15:47dom96But I like the semantic distinction between 'add' and 'write' to be: add never blocks and write may block.
16:16:16dom96The FutureStreams I implemented in that PR currently use 'put' for this 'write' operation
16:16:30dom96But for the sake of consistency with the streams module I will rename it to 'write;
16:17:15*carterza quit (Quit: carterza)
16:17:32dom96This consistency makes working with synchronous (streams in the streams module) and asynchronous streams (FutureStream) much easier.
16:18:06euantorI like write, makes sense.
16:18:13dom96(For example, the following 'when' block could be removed: https://github.com/nim-lang/Nim/pull/5373/files#diff-232b8586e82bf9dedf2b071ec6fd52aaR891)
16:18:35dom96(The multisync macro takes care of the difference between 'await' and no 'await' for sync IO)
16:18:59dom96euantor: Great :)
16:19:37dom96It's tough to design things like this so for anyone interested in this please take a look at the PR and let me know what you think.
16:20:26dom96I'm still unsure about FutureStream[T], it's not an interface like the Stream type and I wonder whether it should be.
16:21:51dom96In the meantime, the PR implements an efficient synchronous and asynchronous downloadFile so I can move on with choosenim :)
16:22:16euantorI've not looked at it, hadn't even realised there was a PR for it already. Would be great to have it in though
16:22:31euantorPerhaps the reason I like read/write is https://msdn.microsoft.com/en-us/library/system.io.stream.write(v=vs.110).aspx
16:22:55euantor.net's Stream type is used heavily and is quite well implemented
16:23:20euantor(though it lacks a method to read up until a given delimiter, which I always end up implementing as an extension method)
16:36:27*carterza joined #nim
16:37:16*yglukhov quit (Remote host closed the connection)
16:37:18AraqI'll say it again here, IMO Nim should move to use somewhat more operator
16:37:21Araqs
16:37:47Araq$, len, &= (for add/push/write/sink), and for reading I suggest ^
16:38:02Araqso that would be 4 highly generic common operations
16:38:14dom96and I'll say what I said again: What I like about Nim is its avoidance of operators.
16:38:23dom96and I continue to use 'add' instead of &=
16:38:32dom96and inc instead of +=
16:38:41Araqput it in the tutorial and enjoy a "don't make me think" language
16:39:09dom96programmers shouldn't be zombies
16:39:10demi-dom96: agreed
16:39:37Araq'add' and 'read' are more common than + and - in some domains
16:39:58Araqit's tiresome we only have nice operators for things that came from math.
16:40:32AraqNim doesn't turn into APL or Perl anytime soon with these carefully chosen constructs.
16:40:32*yglukhov joined #nim
16:40:34*carterza quit (Ping timeout: 240 seconds)
16:41:05Araqbut *shrug* I know my opinion is a minority opinion so I won't fight for it.
16:41:28dom96In fact, I dislike the `^` for reading and think that Channels should use 'read' instead.
16:41:46Araq^ is sexy :P
16:41:47federico3*shudders* perl
16:41:59dom96No, it's not.
16:42:26Araqfederico3: I said it *doesn't* turn into perl :P
16:42:50federico3Araq: I saw that. I just wrote "*shudders* perl"
16:44:41*yglukhov quit (Ping timeout: 240 seconds)
16:55:21FromGitter<andreaferretti> @dom96 I just noticed you (perhaps without noticing) work around https://github.com/nim-lang/nimble/issues/305 too
16:55:29FromGitter<andreaferretti> here https://github.com/nim-lang/nimble/blob/master/nimble.nimble#L34
16:56:08FromGitter<andreaferretti> if you changed that line to `setCommand "c", "tester.nim"`
16:56:35FromGitter<andreaferretti> you would get all tests result together
16:56:52dom96huh
16:56:56dom96What did I work around?
16:57:05FromGitter<andreaferretti> well, the main issue I have
16:57:16FromGitter<andreaferretti> is that whenever I write a task to run tests
16:57:25FromGitter<andreaferretti> using `setCommand`
16:57:34FromGitter<andreaferretti> all the output comes together at the end
16:57:46FromGitter<andreaferretti> here you are lucky that tester has no deps
16:57:52FromGitter<andreaferretti> so you can just run nim
16:58:13FromGitter<andreaferretti> if there was some dependency, you would be forced to use `setCommand`
16:58:21FromGitter<andreaferretti> so that nimble handles the deps paths
16:58:39FromGitter<andreaferretti> and then you would have the same problem I have on all my libraries
16:58:55dom96and why can't you just write 'exec 'nimble c tester.nim''?
16:59:13FromGitter<andreaferretti> because nimble buffers all output! :-D
16:59:58FromGitter<andreaferretti> I can write it like that, but in any case I have to wait until all tests run
17:00:10FromGitter<andreaferretti> and then get a dump of all results
17:00:59dom96I see.
17:01:17dom96The correct fix is to show live output in the right situations.
17:01:42FromGitter<andreaferretti> I think so
17:01:47dom96So in this case whenever the 'c' subcommand is passed to Nimble
17:02:08FromGitter<andreaferretti> yup
17:05:07shashlickhow do I pass a string as a reference to a proc and then use it in the proc?
17:05:35shashlickproc name(str: ref string)
17:06:18shashlickreason being it is a very large string so trying to avoid making a copy
17:15:04FromGitter<Varriount> dom96: Regarding your PR, what are future streams?
17:15:43federico3what's tester.nim?
17:16:07FromGitter<Varriount> shashlick: passing arguments never copies them, unless you use special pragmas
17:16:25dom96federico3: a script that runs tests.
17:16:32FromGitter<Varriount> Strings and sequences only copy on assignment operations
17:16:53shashlickVarriount: excellent, thanks
17:16:56*yglukhov joined #nim
17:16:58federico3is it published somewhere?
17:17:18dom96federico3: it's program-specific. Take a look inside it.
17:17:28federico3I'm writing something similar
17:17:59FromGitter<Varriount> federico3: What is published?
17:18:08dom96Varriount: A way to send/receive multiple pieces of data over-time asynchronously.
17:18:46dom96or perhaps a better explanation: they allow you to react to data immediately, before all of it is received.
17:19:01dom96In the case of the httpclient: let's say you're downloading a 100MB file.
17:19:10dom96You don't want to wait until the 100MB is downloaded before you save it to disk
17:19:15dom96You want to save the data as it's coming in
17:19:22dom96The FutureStream allows you to do that
17:27:12*yglukhov quit (Remote host closed the connection)
17:27:34dom96does that make sense?
17:37:42*cjbest joined #nim
17:39:38FromGitter<Varriount> Yep.
17:43:03FromGitter<Varriount> dom96: So what kind of input do you want exactly? The PR doesn't outline any concerns.
17:43:38shashlickis it possible to unload a module while running? I'm trying to stop accessing a DLL the module is using
17:44:00*cjbest quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:44:04dom96Varriount: Whether the API for it looks good.
17:44:17dom96And anything else that you might see wrong with it :)
17:45:28dom96shashlick: afraid not
17:47:44shashlickI see unloadLib() which could work but since the DLL is loaded with dynlib in the module, I don't have the handle
17:49:12shashlicknot by loadLib() that is, but {.cdecl, dynlib: libname, importc: "function".}
17:49:20*cjbest joined #nim
17:50:07dom96You would need to load it manually to use that.
17:50:21dom96You could do that but it would be a bit painful
17:50:44dom96You could probably write a nice pragma macro to make it nicer though
17:50:57dom96That might be a nice addition to Nim actually
17:51:23*dom96 still hopes I can load openssl on-demand
17:51:28dom96*hopes he
17:55:19shashlickdom96: so if I loadLib() before the module import, it would reuse the handle I have? doesn't sound like it would be that simple...
17:55:30dom96nope
17:56:04dom96You would have to mess with pointer casts to procs
17:56:08dom96and stuff like that
17:56:19shashlickseems beyond my understanding at this point :/
17:56:27dom96Why do you want to unload a module?
17:57:46shashlickwell, so I want to distribute a single EXE app and am using libcurl, so am carrying it within the EXE and writing it out on startup
17:57:55shashlickjust curious if i could clean up on exit
17:59:26shashlickso much easier just to use curl.exe at this point and throw it in TEMP
17:59:29*chemist69 quit (Ping timeout: 240 seconds)
18:00:20*ofd joined #nim
18:04:08*chemist69 joined #nim
18:08:27*gokr joined #nim
18:09:39dom96shashlick: you're embedding the dll inside the .exe and then writing it beside the .exe?
18:10:57shashlickyep
18:11:14shashlickworks fine, i was just venturing into cleanup and that doesn't work since it's in use
18:13:52dom96wouldn't it be better to statically link libcurl?
18:17:47*gangstacat quit (Ping timeout: 255 seconds)
18:19:19*gokr quit (Ping timeout: 256 seconds)
18:23:04shashlickya for that I'd need to find a static build of libcurl for windows, no patience to build it myself
18:23:51shashlickand the libcurl website doesn't have .lib files, just .dll
18:24:34dom96true :\
18:25:29dom96Doesn't the DLL get loaded at the start of your program though?
18:25:46dom96How are you able to write the DLL to disk before that happens?
18:27:30shashlickI do the import after I write it out and wait long enough for it to hit the disk
18:27:41*yglukhov joined #nim
18:27:45shashlickdoesn't seem to mind :)
18:31:03dom96Cool. Wouldn't have expected that to work :)
18:32:21*yglukhov quit (Ping timeout: 260 seconds)
18:34:34shashlickwould have preferred the lib since it is smaller, but i've already written the code to run curl.exe so I can get around to that some day
18:37:00*cjbest quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:46:07*ibk quit (Quit: Connection closed for inactivity)
18:49:29Araqshashlick: can't you compile curl with visual studio or mingw to build a DLL/static lib?
18:50:40shashlicki might eventually, just want to stick to learning Nim right now rather than bridging off into libcurl on mingw headaches
18:51:10shashlickright now, am trying out the spawn statement and getting Error: 'spawn' takes a GC safe call expression
18:56:24Araqspawn foo(a, b, c) # error
18:56:42Araqproc foo(...) {.gcsafe.} = ... # annotate with .gcsafe
18:56:55Araqcompiler says "is not .gcsafe because ..."
19:03:14shashlickhow am I confident that it is gcsafe? looking at the proc and underlying code, i'm not writing any global vars or vars passed in, am just reading the registry
19:08:05shashlickI see the gc safety section in the manual, will check it out
19:08:37Araqshashlick: unfortunately external libs might not be .gcsafe even though they actually are
19:09:09Araqyou can use {.gcsafe.}: offendingLineHere() in your proc to make the compiler shut up then
19:09:15Araqbut that's a last resort
19:09:30Araq(only available on devel, omg we need to add that to the news...)
19:14:06shashlickI was worried, but this is great - I added .gcsafe. and build, now compiler tells me exactly what isn't gcsafe in its opinion which is helpful
19:14:18shashlickit's in the winregistry module
19:14:55shashlickwinregistry.nim(356, 6) Warning: 'queryMaxKeyLength' is not GC-safe as it accesses 'nullWinString' which is a global using GC'ed memory [GcUnsafe2]
19:17:07*yglukhov joined #nim
19:20:36shashlickfigured it out, will submit a bug report to winregistry - simple fix, each proc can have its own copy of nullWinString
19:24:10Araqk great
19:26:34shashlickhttps://github.com/miere43/nim-registry/issues/4
19:29:24shashlickcan you share a global read-only (let) string safely somehow? what's the concern with sharing it if it isn't expected to change
19:29:55*carterza joined #nim
19:29:58*yglukhov quit (Remote host closed the connection)
19:34:44*yglukhov joined #nim
19:36:40Araqshashlick: people can do crazy things, so the compiler is conservative
19:37:11FromGitter<Varriount> What about a const string?
19:38:05*Matthias247 quit (Read error: Connection reset by peer)
19:38:29dom96hrm, splitFile("foo.tar.gz").ext gives "gz"
19:38:39shashlickboth const and let vars seem excusable, but I don't know enough about concurrency to claim that
19:38:49*yglukhov quit (Remote host closed the connection)
19:38:52dom96shouldn't it be .tar.gz?
19:39:30Araqno.
19:41:40shashlickis there a pragma to excuse such global variables?
19:42:12dom96ok
19:42:31Araqhttp://unix.stackexchange.com/questions/181410/how-to-find-a-file-extension-with-multiple-dots
19:42:39Araqshashlick: .threadvar ? :P
19:43:37Araqhttp://stackoverflow.com/questions/21692444/get-file-extension-with-a-file-that-has-multiple-periods
19:44:06Araq^ others agree with nim's stdlib, the extension is actually .gz
19:45:57*yglukhov joined #nim
19:46:08*bjz joined #nim
19:49:10shashlickthreadvar won't work for immutable variables since you cannot set the value on init with threadvar, but "let" doesn't like it without a value
19:50:11*yglukhov quit (Ping timeout: 240 seconds)
19:54:51*couven92 joined #nim
19:55:05shashlickI feel an immutable global should be copied across into threads implicitly
20:01:11Araqthat feature is in development but it's surprisingly hard and for your case it seems unnecessary anyway
20:01:42Araqthat package shouldn't require globals for anything.
20:07:33*chemist69 quit (Ping timeout: 256 seconds)
20:08:36*chemist69 joined #nim
20:09:55*ofd quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:11:57*ofd joined #nim
20:19:22shashlickunderstood, i've implemented it as a threadvar for now, no issues
20:27:31*ofd quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:48:10*nsf joined #nim
20:51:10*carterza quit (Quit: carterza)
20:51:58*gokr joined #nim
20:58:22*vlad1777d quit (Remote host closed the connection)
21:00:51*ofd joined #nim
21:11:11*bjz quit (Ping timeout: 240 seconds)
21:12:08*rokups quit (Quit: Connection closed for inactivity)
21:13:36*bjz joined #nim
21:24:37*Jesin quit (Ping timeout: 256 seconds)
21:29:06*Jesin joined #nim
21:32:13*ofd quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:33:38*Jesin quit (Max SendQ exceeded)
21:35:31*Jesin joined #nim
21:38:47*Jesin quit (Max SendQ exceeded)
21:39:28*Jesin joined #nim
21:48:03*yglukhov joined #nim
21:52:06*yglukhov quit (Ping timeout: 240 seconds)
21:55:59*Vladar quit (Remote host closed the connection)
22:09:56*bjz quit (Ping timeout: 245 seconds)
22:10:10*bjz joined #nim
22:12:41*gangstacat joined #nim
22:17:02*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:21:23*gokr quit (Ping timeout: 264 seconds)
22:50:11*ofd joined #nim
22:50:24*rauss joined #nim
23:01:15*nsf quit (Quit: WeeChat 1.7)
23:20:03*vlad1777d joined #nim
23:25:17*couven92 quit (Read error: Connection reset by peer)
23:27:22*rektide_ quit (Quit: leaving)
23:27:49*rektide joined #nim
23:28:32*ofd quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:28:58raussI can't really tell if I'm just an idiot or inexperienced, or if I just happened to pick a hard library to try and wrap with c2nim =\. Probably the former
23:37:46*eizua joined #nim
23:44:26*Trustable quit (Remote host closed the connection)
23:45:17dom96rauss: Don't be so hard on yourself. What's the problem?
23:46:01raussdom96: I'm trying to wrap ChakraCore, a JavaScript runtime
23:46:41raussdom96: And I just keep coming to issue after issue. Most I can fix, some I have to comment out (or don't know how to fix), and others just elude me completely.
23:46:44dom96ooh, awesome.
23:48:30dom96What might be better for you is if you just wrap the classes/functions that you know you will need. Wrapping the full library is likely not necessary.
23:49:05dom96But of course, feel free to ask questions about any errors you run into here.
23:49:56raussThat's an interesting thought.
23:50:25dom96I guess that you just mainly want to execute some JS using this, right?
23:50:42raussYes
23:51:01dom96Surely there is a nice function that does just that in ChakraCore :)
23:51:32raussI may well need all of or most of the functions
23:51:57raussBut you saying that at least gives me another option of "skip it" if I can't fix an issue with something I might not need.
23:53:07raussdom96: So at this point I'm passed all of the c2nim errors themselves, but getting nim compilation errors
23:53:25dom96Yeah, and you can compile a list of things that you can't get translated. Then somebody here can take a look at it and give you some advice.
23:53:33dom96oh, I might be able to help with those
23:56:05dom96So feel free to gist the errors so that I can take a look.
23:57:40FromGitter<rosshadden> dom96: ⏎ Given this c (taken from various places out of context, for simplicity): ⏎ ⏎ ```ChakraCommon.nim(632, 3) Error: redefinition of 'JsValueRef'``` [https://gitter.im/nim-lang/Nim?at=589fa4f321d548df2cf8b457]
23:58:22raussdom96: I can gist if that's easier. I switched to gitter for code writing
23:58:30*ofd joined #nim
23:58:32dom96np, that's fine too