<< 17-06-2016 >>

00:00:14cheatfatedom96, because of your `comments` under my PRs
00:00:42mahasamootnewby question hear. 1) array length needs to be know at compile time? 2) How do declare an array (or seq) of seqs of type char?
00:01:40*gokr quit (Ping timeout: 264 seconds)
00:04:41dom96cheatfate: I'm sorry if I came across in that way. I most certainly don't hate you, I just like to be frank in PRs and your PRs tend to change a lot of things.
00:04:42renesac_mahasamoot: : (1) yes, if you need dynamic size use a seq
00:05:22renesac_(2) normally
00:06:08renesac_seq[seq[char]]
00:06:14renesac_though you might want to use a string
00:06:18*Joey__ quit (Quit: Page closed)
00:07:38mahasamootvar chains = seq[seq[char]]
00:07:57*mcc joined #nim
00:09:11renesac_var chains = newSeq[seq[char]]()
00:10:06mahasamootthanks!
00:13:14dom96good night
00:21:24*mahasamoot quit (Ping timeout: 276 seconds)
00:22:21*yglukhov joined #nim
00:24:15*deavmi_mobile joined #nim
00:26:31*yglukhov quit (Ping timeout: 240 seconds)
00:31:32cheatfatedom96, you made a great work on async core, but progress is based on changes, so you just need to accept it...
00:38:27*arnetheduck quit (Ping timeout: 246 seconds)
00:39:26mccNo reverse() for seqs/arrays in the nim standard library, right?
00:58:04*GangstaCat joined #nim
01:01:19*mahasamoot joined #nim
01:16:11*vegansk quit (Ping timeout: 240 seconds)
01:25:59*vegansk joined #nim
01:27:30*sdw quit (Ping timeout: 244 seconds)
01:46:31mahasamootlet states = set[var c: char for c in var s string for s in chains]
01:46:53*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
01:47:55mahasamoot?
01:48:05mahasamootwhat am I doing wrong?
01:48:20*bjz joined #nim
01:49:27kiermahasamoot: https://gist.github.com/kierdavis/bd0e7604f57db0e9166834ec7e4d7113
01:49:32kieris that what you're attempting to do?
01:50:23mahasamootyes
01:50:55*chemist69_ joined #nim
01:51:22mahasamootthat can't be done as a one liner?
01:51:57*akaisora_ joined #nim
01:52:25kiermight be able to squish the loop onto one line, not sure if its valid to do that
01:52:45kierbetter to be explicit with that you're doing IMO
01:54:12mahasamootkool, thanks!
01:54:30*chemist69 quit (Ping timeout: 272 seconds)
01:54:41vktecIs there any way to have types that contain themselves? I'd like to create a type that can contain another instance of that type, or nil if it's the end of the "tree"
01:55:18vktecOh, hang on, fixed it :)
01:55:47vktecI was supposed to use seq[Type] anyway, and that worked without errors
01:59:40vktecDoes Nim provide a way to pass around procs as values?
01:59:52vktec(ie. pass a proc to another proc)
02:01:07mccvktec: yes, see "procedural type" in the manual
02:01:32mccalso, i think the reason it was not allowing you to have types that contain types is you should have been using "ref object" and not "object"
02:02:37mcca self-referential object is like struct X { X x; } and a self-referential ref object is like struct X { X *x; }, if you're familiar with C.
02:08:36*akaisora_ quit (Remote host closed the connection)
02:09:52*mahasamoot quit (Ping timeout: 244 seconds)
02:14:21Demosstruct X { X x } is gunna be a bad time
02:18:05*GangstaCat quit (Ping timeout: 260 seconds)
02:23:30*freezerburnV quit (Ping timeout: 250 seconds)
02:25:19*yglukhov joined #nim
02:26:47*branduardi_ joined #nim
02:29:34*yglukhov quit (Ping timeout: 250 seconds)
02:29:47vktecmcc: Thanks, procedural types should do exactly what I need
02:29:59*GangstaCat joined #nim
02:30:33vktecAnother question: is there a way to use a keyword ("block" in this case) as a property name (is that what it's called?) for a type?
02:31:04*hendi quit (Ping timeout: 264 seconds)
02:38:36Demosbackticks
02:38:42Demos`block` : int
02:38:47Demosor w/e
02:39:16Demoscheers
02:40:45mccdoes nim have a specific piece of terminology for non-ref types
02:40:51mcci keep saying "non-ref types" and it is awkward
02:43:43DemosI use value type
02:43:48Demosmyself
02:43:51Demosor just type
02:44:03Demoswe used to name types TThing for value types
02:44:06Demosand PThing for refs
02:44:37DemosI actually don't use ref types that often in my code (unless I'm making lots of trees I find I don't need them that often
02:45:54mccok
02:46:34mcci'm finding myself using ref types because polymorphism has some issues with value types
02:51:03*Demos quit (Read error: Connection reset by peer)
02:53:34*Demos joined #nim
03:10:10mcc...huh
03:10:36mccdoes nim math not have a fabs/abs function?
03:42:10*bjz_ joined #nim
03:43:26*bjz quit (Ping timeout: 272 seconds)
03:43:53*francisl joined #nim
03:58:06*Demos quit (Read error: Connection reset by peer)
04:02:44*Demos joined #nim
04:03:13Demosyo mcc, I'm pretty sure there is an abs function
04:03:17Demosit my be in system though
04:03:45Demos(lots of things are in system, but they are slowly moving to their proper modules
04:07:03*GangstaCat quit (Quit: Leaving)
04:17:54*edub4rt quit (Ping timeout: 250 seconds)
04:26:59*Demon_Fox joined #nim
04:27:30*yglukhov joined #nim
04:31:37*yglukhov quit (Ping timeout: 244 seconds)
04:57:33*brson joined #nim
05:04:10*Demos quit (Read error: Connection reset by peer)
05:04:13*francisl quit (Quit: francisl)
05:19:03*brson quit (Ping timeout: 240 seconds)
05:27:02*brson joined #nim
05:32:22*chrisheller quit (Remote host closed the connection)
05:34:16*brson quit (Ping timeout: 272 seconds)
05:46:39*mcc quit (Quit: Connection closed for inactivity)
05:57:31*yglukhov joined #nim
06:00:26*endragor joined #nim
06:01:51*yglukhov quit (Ping timeout: 246 seconds)
06:02:15*Demon_Fox quit (Remote host closed the connection)
06:06:27*brson joined #nim
06:09:54*chrisheller joined #nim
06:20:55*s4 joined #nim
06:26:08*endragor_ joined #nim
06:30:05*endragor quit (Ping timeout: 260 seconds)
06:32:42*endragor_ quit (Remote host closed the connection)
06:34:19*vendethiel quit (Quit: q+)
06:35:06*endragor joined #nim
06:55:44*endragor quit (Remote host closed the connection)
06:56:56*tankfeeder joined #nim
07:08:24*endragor joined #nim
07:09:16*yglukhov joined #nim
07:12:25*chrisheller quit (Ping timeout: 252 seconds)
07:14:19*endragor quit (Remote host closed the connection)
07:14:48*endragor joined #nim
07:17:55*chrisheller joined #nim
07:20:55skrzypIs CLang stable enough to use with Nim?
07:22:01tankfeederclang itself or integration?
07:22:17skrzypintegration, mostly
07:22:27skrzypbut clang itself too, I have zero experience with llvm
07:25:13*endragor quit (Remote host closed the connection)
07:26:08*gokr joined #nim
07:28:23tankfeederwrong question, are care about nonsense
07:30:34*chrisheller quit (Ping timeout: 252 seconds)
07:33:09gokrvktec: You solved it through other means but IIRC you can have cycles in types if they are in the same type section.
07:38:19*PMunch joined #nim
07:40:04skrzypdom96: take a look at this
07:40:06skrzypError: execution of an external compiler program 'clang -c -w -pthread -O3 -I/home/skrzyp/src/lang/nim/nim/lib -o /tmp/nimble_85185/githubcom_
07:40:08skrzypnimlangAporia/nimcache/stdlib_system.o /tmp/nimble_85185/githubcom_nimlangAporia/nimcache/stdlib_system.c' failed with exit code: 256
07:40:10skrzyp/tmp/nimble_85185/githubcom_nimlangAporia/nimcache/aporia_settings.c:185:1: error: unknown type name 'pthread_t'
07:40:12skrzypthe same issue as with GCC
07:44:13tankfeederthis is the different story, open issue then
07:52:50*deavmi_mobile quit (Ping timeout: 250 seconds)
07:54:06*endragor joined #nim
08:02:44*Demon_Fox joined #nim
08:04:36*Arrrr joined #nim
08:05:56*euant joined #nim
08:21:01*NhanH quit (Ping timeout: 244 seconds)
08:21:08def-skrzyp: sounds like you should compile with --threads:on
08:21:20def-skrzyp: which the nim compiler should tell you of course
08:22:13*Trustable joined #nim
08:23:35*NhanH joined #nim
08:23:36*federico3 quit (Ping timeout: 244 seconds)
08:43:02*NimBot joined #nim
08:43:03*M-Flox joined #nim
08:43:04*joebo quit (Ping timeout: 246 seconds)
08:43:06*cjh`_ quit (Remote host closed the connection)
08:43:06*cjh` joined #nim
08:43:06*skrzyp1 is now known as skrzyp
08:43:08*g00 joined #nim
08:43:10*Arrrr quit (Ping timeout: 252 seconds)
08:43:10*Amrykid2 quit (Ping timeout: 252 seconds)
08:44:08*joebo joined #nim
08:51:03*federico3 joined #nim
08:53:34*Arrrr joined #nim
08:53:34*Arrrr quit (Changing host)
08:53:34*Arrrr joined #nim
08:56:42*tankfeeder quit (Quit: Leaving)
09:01:06*abbat joined #nim
09:07:43*elrood joined #nim
09:13:10*tankfeeder joined #nim
09:17:12foosballpssst, our Araq has a birthday today! :)
09:19:40*nicanaca0 wishes Araq a happy birthday!
09:20:03ArrrrI read somewhere that nim tables are very efficient for a small key count. If this is true, around how many of them ?
09:20:29Arrrr(I believe it was in that benchmark repo)
09:21:12*PMunch starts singing happy birthday to Araq
09:21:14cheatfateHappy birthday Araq!
09:23:50*endragor quit (Read error: Connection reset by peer)
09:23:50*deavmi_mobile joined #nim
09:24:00*endragor_ joined #nim
09:25:40M-Floxbirthday? today? Araq? is that true?
09:28:03*deavmi joined #nim
09:28:16*deavmi_mobile quit (Client Quit)
09:29:56foosballi don't lie, why should i?!
09:30:01*deavmi_mobile joined #nim
09:31:21cheatfatebut Araq_ is still sleeping
09:31:30deavmiello o//
10:04:39*abbat quit (Ping timeout: 260 seconds)
10:06:30*jjido joined #nim
10:33:02Araq_hey guys, thanks.
10:33:15Araq_yeah it's true, today is my birthday
10:33:55PMunchCongratulations!
10:34:53flyxcongrats Araq_!
10:35:22deavmiAraq_: Happy birthday man! :)
10:37:15Araq_Arrrr: they are also efficient when you have many many keys
10:38:19Araq_thanks again :-)
10:39:49*Arrrr quit (Ping timeout: 244 seconds)
10:42:15*taotetek joined #nim
10:45:54M-FloxHappy Birtday Araq and all the best for the future!
10:46:07vktecAraq_: Happy birthday!
10:47:53deavmiHas anyone here compiled Nim successfully on OpenBSD?
10:53:26euantHappy birthday Araq_
10:53:49euant@deavmi: I compiled 0.13.0 on OpenBSD a while back, but only Nim, not Nimble
10:54:01euantThere was also quite a lot of discussion about it here yesterday
10:54:26euantThe current HEAD from GitHub should compile fine
10:56:40cheatfateAraq_, is there any Travis CI problems?
10:56:52cheatfatethere no more tests for my new PR
10:57:18tankfeederi've checked nim tests on openbsd with all malloc guards. passed
10:57:28cheatfateor maybe because i named it like previous closed
11:01:06cheatfateAraq_, ping
11:01:41elroodhappy birthday, Araq_
11:03:16deavmieuant: Did everything go well? Can I use the script from nim-lang.org/download.html
11:03:47deavmieuant: *to build Nim on OpenBSD
11:04:01euantdeavmi: It worked fine for me. I followed these instructions: https://github.com/nim-lang/nim#compiling
11:06:13vktecCan someone help me out with this? https://gist.github.com/vktec/be0b81ee909361d12430f6fb14cb1c9f
11:07:24deavmieuant: Thanks
11:23:51*deavmi_mobile quit (Ping timeout: 240 seconds)
11:26:51vktecSo..... any ideas on my issue?
11:28:40PMunchHmm, I'm not 100% sure but I don't think you can have a T without defining the type in the call
11:29:06PMunchI think you might want to look into: nim-lang.org/docs/manual.html#multi-methods
11:29:24vktecThanks, I'll take a look
11:30:05PMunchAn option is to return a pointer which you then need to get a value from depending on what type the object has
11:30:47*namnguyen quit (Ping timeout: 250 seconds)
11:30:57vktecThe aim is to make this proc do that behind the scenes
11:31:32PMunchWhat is the end goal?
11:31:55*chrisheller joined #nim
11:34:05M-Floxafaik T needs to be passed as a parameter to the call
11:34:26vktecI'm writing a DSL-ish interpreter, and I need to be able to get the value of a variable from that in Nim, but it should (preferrably) be done through 1 Nim type and 1 method, without having to specify the desired type.
11:34:39vktecY'know, now that I say that, it sounds kinda stupid XD
11:35:09vktecHmmm... I came up with a better way
11:35:16vktecLemme see if this'll work
11:35:38M-Floxyou can probably also use a template for that
11:36:25*chrisheller quit (Ping timeout: 252 seconds)
11:38:46vktecI tried using a template... it didn't seem to work either :-/
11:40:31M-Floxyea, just tried it
11:43:18*namnguyen joined #nim
11:45:24*edub4rt joined #nim
11:47:05*Arrrr joined #nim
11:51:25*abbat joined #nim
11:51:48vktecI'm defining a proc like this: proc value[T](foo: Bar): [T] =
11:52:02vktecI want to call it like this: value[str](foo)
11:52:11vktecHow can I do that?
11:52:51PMunchA macro?
11:53:29vktecOkay.... Wierd though, I've seen that pattern in the standard library...
11:53:47vktec(https://github.com/nim-lang/Nim/blob/master/lib/pure/collections/sets.nim#L346)
11:53:47PMunchOh, then I might be wrong :P
11:54:09vktecOr at least, a very similar one
12:01:07*desophos quit (Read error: Connection reset by peer)
12:04:34*abbat_ joined #nim
12:04:43*abbat_ quit (Remote host closed the connection)
12:04:59*abbat_ joined #nim
12:05:16*abbat quit (Ping timeout: 264 seconds)
12:05:30*abbat_ quit (Client Quit)
12:06:44*abbat joined #nim
12:16:32edub4rtis there a function in nim that does the opposite of addr()? (e.g. takes an address, remove the pointer and cast its to a type)
12:17:33renesac_foosball
12:17:50def-edub4rt: []
12:17:51renesac_oops,nothing
12:17:58renesac_sorry
12:20:47edub4rtodd name, that's why I didn't find easily in the documentation, but worked, thanks
12:21:09renesac_well, first, happy birthday Araq_
12:21:21*filcuc joined #nim
12:21:42renesac_I was looking at nim hash tables, and it seems there are at least 3 essentially identical implementations in the form of:
12:22:01renesac_tables/sharedtables, sets and strtabs
12:23:58renesac_the tableimpl only shares code with the first two, but could be of use for the other two as well
12:25:08renesac_as for the strtabs, wouldn't a distinct type for those style insensitive strings solve the problem better?
12:25:48*themagician quit (Ping timeout: 246 seconds)
12:26:29*themagician joined #nim
12:33:24*themagician quit (Ping timeout: 260 seconds)
12:36:27*themagician joined #nim
12:37:15*aziz_ joined #nim
12:37:29*aziz_ quit (Client Quit)
12:38:29edub4rtdom96: I have seen in commit history that you worked most on the asyncdispatch, asyncnet module, as I am planning to use it heavily for networking and async tasks in general I wanted to know if there is a roadmap for it somewhere, to fill me in with the current state and future of async stuff in nim
12:39:12edub4rtcheatfate, maybe you have some thoughts on it too?
12:40:40cheatfateedub4rt, this is dom96 roadmap https://github.com/nim-lang/Nim/issues/4123
12:41:43cheatfateedub4rt, and mine is here https://github.com/nim-lang/Nim/pull/4309
12:43:42cheatfatealso i think some kind of async pipes also needed
12:43:55cheatfatebut this not from async core
12:44:02edub4rtcheatfate, that new async core is roughly working already?
12:44:23cheatfateedub4rt, its already old...
12:44:34cheatfateit is some patches behind...
12:45:03cheatfateand mostly it waits for Araq's and dom96 review
12:46:13cheatfateand I want to take a break from work on asyncdispatch
12:46:41edub4rtI see, that seems like a lot of rework, might take time than to review and merge then
12:48:27edub4rtcheatfate, nice job with the other PR that merged today, I'm using already
12:52:18edub4rtcheatfate, do you have any idea how many request per second can the asynchttpserver handle for a static page? I saw on https://github.com/nim-lang/Nim/issues/3909 that you did some benchmarks
12:52:54cheatfateedub4rt, all my benchmarks was made in VM
12:53:03edub4rtcause I want to have an idea of performance comparated to nodejs
12:53:42cheatfateso they like "synthetic"... i'm using them only for benchmark my improvements
12:53:50cheatfatenew async core is faster like 20%
12:54:05cheatfatebut old one is still fast enough
12:54:06edub4rtnim seams fast, but working async depends on the asyncdispatch/networking implementation, wich I currently don't know how performant it is
12:55:30edub4rthmm, godo to know, but I want to test myself, does nim have any benchmark class? where are the code for your benchmarks?
12:55:35edub4rtgood*
12:56:57cheatfateedub4rt, i have used wrk
12:57:09cheatfatehttps://github.com/wg/wrk
12:57:13cheatfatebut you can use wrk2
12:57:34cheatfatehttps://github.com/giltene/wrk2
13:02:43dom96Wish I had the time to benchmark async properly and optimise it as much as possible.
13:02:48dom96Please let us know what you find edub4rt
13:05:00*tankfeeder quit (Quit: Leaving)
13:08:23*Demon_Fox quit (Quit: Leaving)
13:12:03*francisl joined #nim
13:18:58edub4rtdom96, cheatfate, https://gist.github.com/edubart/02d982eff30400ffa70a737851ed05bf
13:19:16*abruanese quit (Ping timeout: 252 seconds)
13:19:52dom96edub4rt: cool
13:20:28dom96edub4rt: now compare against Go :)
13:20:34edub4rtat first I was disappointed, but then I saw that I compiled nim in debug mode, in release mode nim is 3.2x faster, debug mode slower hehe
13:21:28dom96heh yeah, debug vs release mode makes a huge difference
13:22:13def-edub4rt: i used to have fun with that exact same "Hello World": https://github.com/def-/nim-http-speedup
13:22:54dom96oh yeah, forgot about def-'s benchmarks
13:23:58dom96Some pretty graphs would help :P
13:28:44edub4rtdef-: so from reading your benchmarks you have found out that with 1 thread, nim's asynchtpp was slower than go/cppsp/h2o
13:29:04edub4rtbut that 1 year ago, from that date was made optimizations?
13:29:19def-edub4rt: some of my optimizations made it into nim
13:29:36def-edub4rt: and the plan is to allow multithreading for async from what I understand
13:46:05*mahasamoot joined #nim
13:47:06*nsf quit (Quit: WeeChat 1.4)
13:50:54mahasamootI'm looking through the docs... In Python the docs will tell you all the methods for each data type. I'm not really seeing that for Nim. So for example in python, list.count(x), does seq.count(x) work in Nim?
13:52:47Araq_http://nim-lang.org/docs/theindex.html#oun
13:53:44*freezerburnV joined #nim
13:54:08Araq_so, apparently not.
13:55:02Araq_not sure why sequtils is missing a count though.
13:56:28mahasamootthanks
13:56:39Araq_that said, I type foo <dot> and see what's available, no need to read docs.
13:56:47dom96looks like the #anchors are wrong for the index
13:57:17Araq_indeed
13:57:42dom96We need Noogle ala hoogle (https://www.haskell.org/hoogle/)
13:57:45mahasamootAraq_: What do you use? I set up vim to do that but it's not working.
13:58:07*freezerburnV quit (Ping timeout: 250 seconds)
13:58:27Araq_mahasamoot: I've heard good things about VSCode
13:59:47edub4rtdef-,dom96: I tested asynchttpserver vs go (with 1 thread), nim outperforms go, I managed to get 100k/s in nim while 55k/s in go, however go with all os threads (4 threads) goes up to 200k/s
13:59:56Araq_dom96: better docs, hoogle, etc are all fine things, but we need to focus, and my focus is clearly on improving nimsuggest.
14:00:10dom96edub4rt: wow, awesome
14:00:19edub4rtdef-: I could not test asynchttpserver in parallel, seams like your asynchttpserver sample does not work anymore, there is no function serveParallel
14:01:19def-edub4rt: i hacked that in
14:01:48mahasamootAraq_: thanks! It looks really nice. I'll give it a try.
14:02:07edub4rtI managed to get from 84k/s to 100k/s in nim by running with "nim -d:release c -r --passC:"-flto -O4" --gc:boehm hello.nim"
14:02:35Araq_boehm does cheat though and does the marking step in parallel
14:02:45edub4rtgc boehm does make a difference, linking with flto a bit
14:03:03def-Araq_: nope, i tested and boehm is about same speed for this benchmark withough threads
14:03:52edub4rtis there any other optimization hack while compiling that I should know off? any flag?
14:04:44*Demon_Fox joined #nim
14:05:56*s4 quit (Quit: Konversation terminated!)
14:08:12*brson quit (Ping timeout: 276 seconds)
14:12:31*brson joined #nim
14:12:44*freezerburnV joined #nim
14:19:16euantI'd love to see search added to the docs. Google can be a little hit and miss
14:19:33*PMunch quit (Quit: leaving)
14:20:06euantI'd also like to see something like readthedocs for Nim too
14:20:48*pregressive joined #nim
14:20:58euantI started writing something like it, I might eventually finish
14:21:28deavmieuant: Mkdocs has static search
14:21:47deavmieuant: But i like the current nim docs. just add search and then it will be awesome
14:22:14euantYeah, mkdocs looks nice
14:22:32euantI like the style of the current docs, could just do with some added consistency between modules
14:22:42deavmieuant: Obviously maybe theme it differently. Like
14:23:04deavmieuant: I like the somber colours of the Nim docs
14:23:13euantBy readthedocs, I meant some kind of site where users can have docs generated for their modules automatically upon Git Push (using GitHub hook)
14:28:56edub4rthaving nim docs into http://devdocs.io/ would be nice too, their search is really straightforward, and combining multiple frameworks/languages into one is a plus
14:38:46lazypenguin1Only complaint I have about the docs is that the menu on the left is not in a seperate frame from the content on the right
14:39:48lazypenguin1would prefer to scroll them independently
14:43:05*euant quit (Quit: Leaving)
14:44:04lazypenguin1e.g. http://imgur.com/ubZp4gL but have the menu on the left scroll with the screen
14:48:03*renesac_ quit (Read error: Connection reset by peer)
14:49:08cheatfatedef-, you dont need multithreaded asyncdispatch to make multithreaded web server :)
14:49:55cheatfateYou need to run 1 thread with own pDispatcher for accepting connections and pass accepted sockets to worker threads which of course has own pDispatcher...
15:08:16*akaisora_ joined #nim
15:15:24*polypus74 joined #nim
15:17:50polypus74hi all. i'm considering nim as a language for x-platform game dev (commercial), most important are ios, android, and linux. macos and windows would be a bonus. how are the sdl bindings? i see there is an official repo: https://github.com/nim-lang/sdl2 ?
15:18:36polypus74any other workable solutions apart from sdl?
15:20:33namnguyenpolypus74, Araq is working on a binding for some 3D engine that I forgot the name.
15:23:59polypus74how is nim on android and ios these days in general? namguyen: ty
15:24:40polypus74googling doesn't pick up much
15:25:09*polypus74 quit (Remote host closed the connection)
15:25:53namnguyenpolypus74, afaik, you'll transpile to C/C++ files, compile them into a dynamic library, then do a thin wrapper with Obj-C/Java
15:25:57*polypus74 joined #nim
15:26:02namnguyenpolypus74, afaik, you'll transpile to C/C++ files, compile them into a dynamic library, then do a thin wrapper with Obj-C/Java
15:28:41polypus74that would be the ideal, but does it actually work? are there issues with the runtime etc?
15:29:22namnguyenwell, once the Nim-C/C++ conversion is done, there's not much else wrt Nim
15:29:51polypus74there's no latform specific runtime stuff?
15:29:57polypus74*platform*
15:30:30namnguyeni have not known of any Android/iOS runtime stuff in Nim
15:30:30polypus74ty btw
15:31:54*polypus joined #nim
15:34:37*deavmi_mobile joined #nim
15:35:16endragor_both Android and iOS support apps developed on C++
15:38:35polypus74i'd rather use nim or even C. i'm also looking into scheme. just to be clear, i know you can compile and link to C on android and iOS, i'm just wondering if anybody has actually succesfully done so transpiling to C with nim
15:39:00*abbat left #nim ("Leaving")
15:39:24endragor_Nim compiles to C or C++
15:39:41endragor_C is the default backend
15:39:58Araq_polypus74: yglukhov at least does commercial game development with Nim
15:40:19Araq_using the C, JS backends and more recently emscripten
15:40:34Araq_not sure how they handle Android though
15:40:36endragor_so do we, using Unreal Engine 4
15:40:41dom96polypus74: I was able to get Nim code running in an Android app.
15:40:56yglukhovAraq_: android is fine, as well as ios =)
15:41:06dom96Also objective C integration works well, for example: https://github.com/dom96/notifications
15:41:39polypus74very good to hear guys. ty
15:42:12edub4rtafaik where you can use C, you can use nim, if nim does not have the API you need but C does, you can bind the C functions you need with ease
15:42:17yglukhovAraq_: so i've found a way to do transparent emscripten-js bindings, so that you can basically define dom module to be emscripten-compatible.
15:43:58yglukhovAraq_: the way is kinda jnim-ish for emscripten. And it opens unseen possibilities to write emscripten frontends in nim.
15:44:57Araq_btw https://www.stevefenton.co.uk/2012/11/compiling-vs-transpiling/ suggests that Nim *compiles* to C :P
15:45:50Araq_C lacks exceptions, garbage collection, first class iterators and so Nim and C don't operate on a "similar" level of abstraction
15:46:04Araq_so Nim is a compiler, not a transpiler.
15:47:32*jjido quit (Read error: Connection reset by peer)
15:48:42elroodotoh he considers c++ to c transpilation, so.. where's our troll when we need him? *fg
15:48:45namnguyenmy definition of a transpiler is from a high-level language to yet another high-level language.
15:49:03Araq_C is not a high level language :P
15:49:17elroodand c++ isn't either? ;P
15:49:19polypus74if it's source to source i think it can reasonably be called a transpiler, regardless of level of abstraction. of course whenever you start talking about compilers/transpiler/interpreters the lines are fuzzy and people have different opinions. i don't think it's too important. maybe we should just call them all transformers
15:49:34lazypenguin1I'm sure for the more seasoned programmers C is pretty high level :)
15:49:36polypus74C used to be a high level language not too many years ago
15:49:38namnguyenPrime Optimus
15:49:52Araq_actually I agree, but you cannot have it both ways. Either C is a superduper portable assembler
15:50:04Araq_or it's high level.
15:50:10namnguyena high level language is something natural-language-like
15:50:46deavmi_mobileI think high levelness over time switches
15:50:56deavmi_mobilefrom lang to lang. depends on what we are used to.
15:50:59Araq_so yeah, C is a nice portable assembler (that's why GCC is 2 million lines of code or something, because it's so close to the hardware lol)
15:50:59lazypenguin1Just because C is high level, doesn't mean you can't have higher languages
15:51:21deavmi_mobilemaybe a language more easier than python will come out on a few years and will make python no longer high level.
15:51:25Araq_and Nim is just a translator from Nim to C, quite easy to do and that's why it's 80K LOC ...
15:51:28namnguyenagreed. very high, super high, uber high,
15:52:31lazypenguin1Don't think you can call it a translator if there is not a 1:1 mapping
15:52:48lazypenguin1Nim introduces new abstractions which need to be compiled into C
15:53:42elroodAraq_, ah, come on, don't sell yourself short. nim is a great piece of work as it is, and it being just a translator is an intermediate solution - and a clever one
15:54:09lazypenguin1By that logic a C compiler only translates C into machine language
15:54:17lazypenguin1how easy
15:54:30lazypenguin1 /s
15:54:55Araq_elrood: I'm not selling myself short, I'm trying to convince people the only term for it that makes sense is "compiler"
15:55:31edub4rtAraq_: why nim doesn't use a backend like LLVM/gcc instead of compiling to C and then compiling again to machine code? let's say if you started to develop nim today, would you do the same way or use some backend like LLVM/gcc?
15:55:49elroodto be frank, whether one prefers to call it compiler or transpiler or whatever is just nitpicking and an implementation detail
15:55:59Araq_1. an LLVM backend is being worked on.
15:56:11Araq_(not by me though)
15:56:26Araq_2. I would likely target C again.
15:56:38elroodnim is more, docs, spec, tooling, and once more backends are in place and the ties to C(++) aren't as close as they are today that will become irrelevant
15:57:11Araq_the advantages outweight the disadvantages
15:57:34Araq_elrood: yes, but "transpiler" is such an ugly word IMO
15:57:41namnguyenelrood, why should it target a machine language?
15:57:48namnguyenserious question.
15:57:58Araq_"translator", "interpreter", "compiler" all fine terms, but what the heck is a "transpiler"?
15:58:10Araq_;-)
15:58:21polypus74a compiler w/ a sex change :)
15:58:50namnguyenPride month, Pride month
15:59:36namnguyenelrood, targetting a machine language is fine and all, but you'll be on the hooks for all these peep-hole optimizations etc.
15:59:54elroodAraq_, agreed. but it's not mainly about wording but about expressing a viewpoint, semantics
16:02:02elroodnamnguyen, yep, and now you're entirely dependent on a different compiler toolchain, and a different language. it's an assessment of dis- and advantages. for now using c as an intermediary target is a good, even great choice. might not be for the long run
16:02:34namnguyenelrood, on an entirely __popular__ toolchain
16:02:48Araq_this weekend I will again attempt to compile Nim code for my RCX
16:03:03Araq_I have a GCC 2.95 cross compiler that targets it.
16:03:15namnguyeni mean, i have not seen any CPU that doesn't have a C compiler built for it
16:03:23polypus74C as a target is arguably always good to have for any language, unless it has the backing to be targetted to just about everything anyway, the way Go is going
16:03:28elroodnamnguyen, sure, but still a completely detached toolchain
16:03:38Araq_this thing is very outdated, you won't find an LLVM backend for it
16:03:55Araq_compiling to C is a huge advantage.
16:03:57namnguyenelrood, which is exactly the same idea why we have frontend and backend in LLVM, GCC, etc.
16:04:35Araq_you could perhaps try and re-enable the codegen for a newer GCC
16:04:52elroodnamnguyen, i don't know what you are trying to convince me of. i am all for nim as it is now. i don't see it staying that way for all future, though
16:05:29Araq_but GCC's internals changed much more than the C language, especially when the C is generated anyway
16:05:34namnguyenelrood, i'm trying to understand your reasoning for why Nim should have a machine-code backend.
16:05:45polypus74no reason to loose the C target. haskell ghc has let it's c backend rot. that's why i'm here looking at nim
16:05:50Araq_so yeah, generating C was a wise decision.
16:06:05elroodit's a great thing nim has a js backend, and even better that an llvm-based one is in the works. it will and does help keeping the compiler's design modular and extensible
16:08:14*brson quit (Ping timeout: 272 seconds)
16:08:16polypus74namguyen: the more backends the better ;)
16:08:31namnguyenpolypus74, the more stuffs need to be maintained too.
16:09:11polypus74yes, but like i said if the language has the clout, like Go it's OK. i just wish google had picked up nimrod instead
16:09:26elroodnamnguyen, if you read closely, that is not even my reasoning. i do see advantages in having nim not rely on a single independent toolchain, in modularity, etc. ultimately this means generating final code without too many intermediary steps, yes, but that's not the main point
16:09:58elroodanyways, afk for a while. party hard, Araq_ ;)
16:11:15*brson joined #nim
16:13:03*endragor_ quit (Ping timeout: 240 seconds)
16:18:01*yglukhov quit (Ping timeout: 252 seconds)
16:22:10onionhammersoo, how about Safe C? : )
16:22:14onionhammerhttp://www.infoworld.com/article/3084424/open-source-tools/microsoft-open-sources-a-safer-version-of-c-language.html
16:22:19onionhammeras a back end
16:22:29onionhammer"Checked C"
16:24:51*deavmi_mobile quit (Quit: Cheers all. Be good and don't do drugs.)
16:25:19*filcuc quit (Read error: Connection reset by peer)
16:29:40*chrisheller joined #nim
16:34:11*endragor joined #nim
16:34:13*deavmi_mobile joined #nim
16:34:58*deavmi_mobile quit (Client Quit)
16:36:04*polypus74 quit (Read error: Connection reset by peer)
16:36:14*polypus74 joined #nim
16:48:42*yglukhov joined #nim
16:51:16*Matthias247 joined #nim
16:53:05*yglukhov quit (Ping timeout: 260 seconds)
16:53:11*Arrrr quit (Quit: WeeChat 1.4)
16:57:44*Demon_Fox quit (Quit: Leaving)
16:58:01*francisl quit (Quit: francisl)
17:08:01*jjido joined #nim
17:11:03*pregressive quit (Remote host closed the connection)
17:11:36*pregressive joined #nim
17:15:47*renesac joined #nim
17:15:57*pregressive quit (Ping timeout: 250 seconds)
17:19:33*yglukhov joined #nim
17:20:55*yglukhov quit (Remote host closed the connection)
17:20:59*aziz joined #nim
17:28:56*hoaxx joined #nim
17:28:59*g00 quit (Quit: ZNC - 1.6.0 - http://znc.in)
17:29:32*hoaxx quit (Client Quit)
17:32:19*shodan45 joined #nim
17:32:47*wh1t3r0s3 joined #nim
17:33:08*euantor joined #nim
17:34:42*wh1t3r0s3 quit (Client Quit)
17:35:56*wh1t3r0s3 joined #nim
17:36:51*jjido quit (Ping timeout: 276 seconds)
17:39:49*wh1t3r0s3 quit (Client Quit)
17:40:01*francisl joined #nim
17:41:34*wh1t3r0s3 joined #nim
17:45:26*yglukhov joined #nim
17:48:39*branduardi_ quit (Ping timeout: 250 seconds)
17:48:56*yglukhov quit (Remote host closed the connection)
17:49:11*yglukhov joined #nim
17:52:39yglukhovAraq_: is it hard to implement some thisProc(), returning ast of the proc, so that we could refer arguments by index? =)
17:53:22yglukhovand also get _PRETTY_FUNCTION_ stuff for logging, etc.
17:53:42Araq_meh, seems easy but really horrible
17:54:21Araq_the first thing people will do is write macros that only work in a particular invocation context
17:54:22yglukhovreferring to args by index and _PRETTY_FUNCTION_ are good for metaprogramming
17:54:48*deavmi_mobile joined #nim
17:54:48yglukhovdon't worry about that. it already is the case =)
17:55:13Araq_how so?
17:56:04yglukhovwell, it's easy if you don't validate macros input parameters, because pretty much anything could get there =)
17:57:23Araq_it's a design pattern to not valid input parameters
17:57:27Araq_*validate
17:57:39Araq_but I need to write a book about it :P
17:57:52yglukhovyup =)
17:58:10*vqrs quit (Quit: ZNC 1.6.1 - http://znc.in)
17:58:32Araq_I have a 'treegen' module in the works, that takes anything and turns it into a tree
17:58:50Araq_works for any UI library and to produce DOMs
17:59:02yglukhovinteresting...
17:59:47Araq_yeah, it's cool. it requires the trees to have some 'add' operation
18:00:03Araq_it doesn't check its input and so it's type agnostic
18:00:12Araq_but I guess 'concept' would work too here.
18:00:56Araq_but seriously. one design constraint in Nim is that macros cannot go "up" in the AST
18:01:04Araq_so that when I read
18:01:07Araq_foobar:
18:01:11Araq_ baz blah
18:01:27Araq_I know at least not my entire proc is affected by the 'foobar' macro
18:02:35yglukhovi agree they probably should not modify it. but why not read? they already can do it to some extent with getImpl/getType. and as you have seen, we have a compile time nim->glsl codegen thanks to that.
18:03:44yglukhovand with args_referred_by_index i predict it would be a lot simpler to write automagic bridges to foreign languages.
18:04:44yglukhovthat's not really THAT critical for bridges, because they also could be done with current macro system, like jnim.
18:06:01yglukhovmaybe another way is to add more standard macro api to simplify work with ast. like collectArgNamesFromFunctionDefinition, collectArgTypesFromFunctionDefinition, applyFunctionCallToArgs, etc.
18:06:30yglukhovbut _PRETTY_FUNCTION_ is still something i want ;)
18:06:37*Matthias247 quit (Read error: Connection reset by peer)
18:07:15*kingofoz quit (Ping timeout: 244 seconds)
18:08:18*kingofoz joined #nim
18:09:26*francisl quit (Read error: No route to host)
18:10:24yglukhovAraq_, and another question. What do you say if we introduce a smarter js bridging api to enable out-of-the-box emscripten compatibility. E.g. currently js functions are marked .ccpimport.. I can do a lib with .jsimport. macro that expands to .cppimport. for js target, and to something more interesting on emscripten target.
18:10:48*Demos joined #nim
18:11:43*francisl joined #nim
18:11:49deavmi_mobiledo macros start with .
18:11:52deavmi_mobilein nim?
18:12:41Demosno
18:12:49Demosthey work almost like any other procedure
18:12:59Demosexcept you can call them with a few special syntaxes
18:13:17Demosnotably the {.macroName.} annotation and the macro: block syntax
18:14:04yglukhovdeavmi_mobile, yeah, i was talking about the pseudo-pragma macro syntax. {.jsimport.}
18:14:11*euantor quit (Remote host closed the connection)
18:14:21deavmi_mobileare they also contained in {}
18:14:22deavmi_mobile?
18:14:44deavmi_mobileI see
18:14:51deavmi_mobileI will check out macros soon
18:15:16Demosimo the macros are a very interesting feature of nim, but they are not what really draws me to the language
18:15:55*nsf joined #nim
18:15:59yglukhovpragmas are enclosed in {. and .} and you can use a macro name instead of a pragma name, so that it is evalueated with arg being ast of the definition being annotated =)
18:16:51*euantor joined #nim
18:17:23*philo joined #nim
18:17:38yglukhovDemos: true, nim has got a lot of outstanding traits besides macros.
18:17:56Araq_yglukhov: sorry i am busy, will answer soon
18:18:18Demostbh I got here just looking for C with modues
18:18:20Demos*modules
18:18:47Demoswhich like holy crap ISO WG14, it's getting pretty sad
18:19:52*euantor quit (Remote host closed the connection)
18:23:24*euantor joined #nim
18:24:18*brson quit (Ping timeout: 276 seconds)
18:25:37dyce_did .14 have GC improvements?
18:25:44dom96yep
18:26:09dyce_dom96: so jester hello word shouldnt go above 1MB or so?
18:26:23dyce_after answering many requests
18:26:35dyce_for mem usage
18:26:42dom96Dunno. How far above does it go?
18:26:48dyce_3MB
18:26:56dyce_at least with .13
18:27:07Araq_cycle collector kicks in after 4MB
18:27:27philoNewbie question. http://pastebin.com/BUFjMsfV
18:27:51philonot sure how to say it in Nim
18:28:32def-philo: what are you trying to do?
18:29:50philoI'm to add new tuples into a seq
18:30:28philotype mismatch: got (seq[Transition], Array constructor[0..1, s33,15
18:30:54def-what is transitions?
18:30:56def-it's undefined
18:31:12philotype
18:31:12philo Transition = tuple[trans: string, count: int]
18:31:26def-That's "Transition", not "transitions"
18:31:58philosorry, it's seq[string]
18:32:16def-line 8: for c in transCounts.mitems:
18:32:32def-line 12: transCounts.add((t,1))
18:34:45philothanks! why do I need the .mitems?
18:34:54*vqrs joined #nim
18:34:59def-otherwise you get unmodifiable items in the loop, like when you define them with "let"
18:35:17def-the mitems iterator has a "var" return type
18:35:30def-so it yields values that you can modify directly
18:35:42philooh, that makes sense.
18:35:42def-that's useful to specify whether your loop should modify anything and then the compiler checks it
18:37:13*Yousif joined #nim
18:37:53YousifWhy did you blocked me?!
18:38:23YousifOhh, sorry, I thought you stopped my message service.
18:39:08YousifSo, my question is, if I compile to C, can I use Qt GUI libraries?
18:39:34dom96Hrm. You will need to compile to C++ then.
18:39:36*jjido joined #nim
18:39:51Yousifdom96: That is the problem.
18:40:07YousifI don't want to compile to C++.
18:41:33dom96Why?
18:41:36YousifI want to use Qt instead of GTK+, So is there any chance at all?
18:42:34Yousifdom96: Because Qt is MUCH BETTER than GTK+, because the entire world is switching to Qt EVEN GNOME!.
18:42:52dom96No, why do you not want to compile to C++?
18:43:40Yousifdom96: Nim to C is better than Nim to C++.
18:44:03dom96Yousif: how so?
18:44:28Yousifdom96: I asked this to Mr. Araq.
18:44:32YousifHe recommends C.
18:44:38dom96Yousif: I see. I see.
18:45:25*Yousif left #nim (#nim)
18:45:42*jjido quit (Read error: Connection reset by peer)
18:46:34shodan45IIRC PyQt hooks into Qt via C, not C++, so it should be possible
18:47:14shodan45oh he left
18:47:54shodan45I'd also love to see NimQt (QtNim?), especially if it was idiomatic Nim
18:48:15shodan45Qt is very nice, but it's also very C++ ;)
18:48:23shodan45well, C++ + moc
18:49:30philoI'm sorry to be such a bother, but something's still wrong. code: http://pastebin.com/JaqCzjTP output: http://pastebin.com/p5a9TCgr
18:49:33dyce_Araq_: that makes sense, i saw it cut off around 4MB. is there a way to adjust this for embedded devices with around 16mb ram?
18:49:43philotransCounts is empty
18:50:00dyce_or i assume there is some overhead for cpu to have it any lower?
18:50:43*francisl quit (Quit: francisl)
18:50:53*jjido joined #nim
18:51:11def-philo: no problem at all, we're here to help. is transitions empty as well? What should I enter to test it?
18:51:30def-ah, you have something
18:52:16def-philo: that's because transCounts is empty from the start, so line 27 never iterates over anything
18:52:18philoyeah, transitions is working, then nil
18:52:38def-something looks wrong with your algorithm
19:00:03Araq_dyce_: it's a constant in the GC, but currently not exposed in any way
19:00:11Araq_PRs welcome
19:00:49Demoshey everybody
19:00:53Demosthere is NimQML
19:00:57Demoswhich works pretty well
19:02:48Araq_yglukhov: instantiationInfo will get "instantiated from proc" info
19:03:00edub4rtI have a question about the GC, lets suppose I have 1 million small different objects, each one with one ref in the GC, does that mean that the GC will have to do 1 million more iterations to complete a full cycle? I'm asking because I had many problems with that and lua, their gc would get a massive slowdown eating all CPU
19:03:01Araq_and it'll be accessible from macros too
19:03:06Araq_giving you the proc name
19:03:42*Eyman joined #nim
19:04:12Araq_edub4rt: yes and no. it's RC+cycle collection
19:04:16yglukhovAraq_: instantiation info is tuple[filename: string, line: int], no?
19:04:29Araq_cycle collection has the problem you're talking about
19:04:46Araq_but the RC part doesn't and so you're quick a bit more flexible in this case
19:04:52Araq_*quite
19:05:28edub4rtcan the cycle part be disabled GC?
19:05:33Araq_yup.
19:05:50edub4rthow?
19:05:53*Eyman quit (Client Quit)
19:06:03Araq_GC_disableMarkAndSweep()
19:06:27Araq_yglukhov: yes, currently.
19:06:35yglukhovah, ok.
19:07:01Demosalthough better yet just don't create cycles
19:07:05Demosright?
19:07:41Araq_right, but unfortunately the closures that Nim's "async" produces are full of cycles
19:08:15Araq_maybe that's a hint that we're doing async wrong :P
19:08:17Demoswhat if there's nothing in the closure
19:08:21Demosmaybe
19:08:29Araq_there is always everything in the closure
19:08:38Araq_since it's the continuation
19:08:45Demostrue
19:08:47Demosdarn
19:08:53DemosI've never used nim's async
19:09:20Araq_we transfer the stack to the heap
19:09:27cheatfateAraq_, in async i think we can do this without closure(environments)
19:09:48cheatfateAraq_, but now, i forgot about iterator
19:10:03cheatfateAraq_, so currently we can't
19:11:49Araq_cheatfate: once you understand macros better you can try a completely new approach
19:12:06cheatfateAraq_, you have an idea?
19:12:27Araq_and do the sequential code -> state machine transformation directly in a macro, skipping Nim's closure iterators altogether
19:13:50Araq_once you do that, you have more control over where the closures are allocated
19:14:06edub4rtwhat about coroutines? I came from C++ where I used boost.coroutine from working async, each coroutine is a "light thread" with its own stack, when wait is needed, it triggers a context_switch, at first when I saw nim's async mechanism I thought it might be something like that, but I found that, the continuation is always in a closure and futures everywhere
19:14:59Araq_edub4rt: we have that too, but it's not production ready and in theory it's better to compute the continuation than to keep the stack around
19:14:59*miqlas-H joined #nim
19:15:08miqlas-HHi Guys!
19:15:14philoI seeded transCounts and then I get an Error: seq modified while iterating over it.
19:15:21miqlas-HI'm trying to create a proper Nim recipe for Haiku.
19:15:23edub4rtthat made me think, which implementation would be more performant, real coroutines with context switches or using callbacks and futures?
19:15:24cheatfateAraq_, for me its too complex theory, you must describe this on one of your conferences more completely and give me a video :)
19:15:46def-philo: oh right, you're not supposed to do that
19:16:18def-philo: you could make a copy of transCounts and overwrite it after the loop. Or make a new seq for the ones that you want to add
19:16:18miqlas-HI got it compiled already, but for reproducible build i'm creating a recipe (so the build process could automated in the future)
19:16:49Araq_hi miqlas-H I ported Nim to Haiku years ago
19:17:00Araq_does it finally have real thread local storage? :P
19:17:07philodef- thanks
19:17:09*MainNimDev joined #nim
19:17:12cheatfateedub4rt, if there no complex (long) calculations coroutines will be slower, but if there many complex calculations coroutines could be faster
19:18:20*MainNimDev quit (Excess Flood)
19:18:21Araq_edub4rt: the other problem is that Nim's stack is C's stack so it's just one dumb blob of memory we have no pointer information about
19:18:54Araq_whereas with the continuation approach we have precise knowledge over the pointers etc
19:19:37Araq_but yeah, I guess it's one of those superior in theory, much worse in practice ideas
19:20:19miqlas-HAraq: i've seen the preliminary haiku supporting code here and there, but it doesn't work out of the box now.
19:20:28*TheLemonMan joined #nim
19:20:40miqlas-HI'll provide some patches for the bootstrapping process to get it compiled on Haiku.
19:21:09miqlas-HMy question is: can we somehow define the install patf for nim and for the nim cache?
19:21:51miqlas-HAs Haiku got packageFS, some path is ready-only, so we need to define a writeable portion of the file system for extra addons and so on.
19:21:58def-miqlas-H: if nim compiler runs twice at same time with same nim cache it will fail
19:22:03miqlas-Hthe question is: how can i do that?
19:22:40miqlas-Hdef: it is enough it if runs on Haiku, then i'll happy.
19:22:48*jjido quit (Read error: No route to host)
19:23:54renesactable.add - puts a new (key, value)-pair into t even if t[key] already exists.
19:24:08renesacso there can be multiple values with the same key in the table?
19:25:03cheatfateAraq_, if i get `string` type argument why i can't convert it to cstring using cast[cstring](addr(somestring[0]))?
19:25:58*edub4rt quit (Quit: Page closed)
19:26:44vktecWhat should I call a function that returns "first" for 1, "second" for 2, etc?
19:26:55vktecOr better yet, is there a pre-made one out there?
19:27:33*edub4rt joined #nim
19:27:53*mostworst joined #nim
19:28:32Demoshumanize or smth
19:28:51vktecOkay
19:28:54vktecThanks
19:29:38renesacvktec: I just made (and temporarily deleteed) this
19:29:38renesachttps://github.com/nim-lang/Nim/pull/4344/commits/d6849b87c598b70e83acfee122143ebc2b67df45
19:29:51renesacenglishOrdinal
19:30:15vktecThanks, I'll take a look
19:30:26miqlas-HSo can you point me please, how can i set the install path for nim?
19:31:20Araq_miqlas-H: nim read the location of its stdlib from its config
19:31:33Araq_and the config is hardcoded to /etc/something on Unix
19:32:02miqlas-HAraq_: i already found it in the install script.
19:32:27miqlas-HWill nim somehow informed about, where it will found the supporting codes?
19:32:57Araq_nim dump
19:33:03renesacAraq_: can you help me understand nim tables?
19:33:14dom96miqlas-H: Is Haiku's file system Unix-like? Do you have /usr/bin etc?
19:33:17Araq_renesac: the answer to your question is "yes".
19:33:31renesacthanks
19:33:56renesacand any parcitular reason why there is a separate implementation for sets and strtabs?
19:34:43Araq_strtabs predates generics and only lives on because it support case insensitive lookups
19:35:29renesacwouldn't a distinct type for those style insensitive strings solve the problem better?
19:35:32Araq_and I found no good way to do that with Nim's generics, I mean ok, you could create a 'distinct string' that has hash and equality made insensitive
19:35:40renesacah
19:36:40dom96Araq_: Perhaps it would be worthwhile to improve strtabs so that it supports String -> T maps?
19:37:27Araq_perhaps, but then it needs to be made more consistent with tables.nim etc
19:37:32renesacwell, just separate the equality check to a separate function, and put a "when" for use when included in the strtabs
19:37:38Araq_right now it's in the nice "zombie" state
19:37:43renesachum
19:37:55Araq_everything else means work :P
19:39:08miqlas-Hdom96: nope.
19:39:29dom96miqlas-H: So where would you install packages?
19:39:40dom96miqlas-H: Would it be more similar to Windows, where everything is in a single directory?
19:40:43renesacand the documentation for the tables module is not very friendly.. this is compounded by the disorganization of having "duplicate" functions for the different types of tables
19:40:43Araq_yglukhov: " What do you say if we introduce a smarter js bridging api to enable out-of-the-box emscripten compatibility."
19:41:02Araq_I don't really understand what you mean and have no experience with emscripten
19:41:04miqlas-Hbinaries should go into /system/bin, and the other data files (not executables should go into the /boot/system/data/nim or something like that.
19:41:35renesacI still dream of that dynamic documentation organization mockup
19:42:06Araq_renesac: you can dream, you can do it, or you just write some introduction text that explains how tables work.
19:42:15miqlas-Hi never ever installed nim, so i have no idea what kind of data files will it install and where.
19:42:55renesacright... there is no proc to return all the values with the same key in the table, right?
19:42:56dom96miqlas-H: Then I suggest you install all of Nim's files into /boot/system/data/nim then symlink /boot/system/data/nim/bin/nim into /system/bin/nim
19:43:15renesacit always return the first one found?
19:43:21vktecI asked a while ago, but completely forgot, sorry: what is the module for key-value stores in Nim?
19:43:34renesacvktec: tables
19:43:39vktecThanks
19:44:20miqlas-Hnope, every executable should be in /system/bin or yet better $bindir
19:47:50miqlas-Hok, i made a temporary install into a scratch folder.
19:48:41miqlas-HI got it installed, i got a nim folder in my prefix, and it have some other folders: bin, compiler, config, doc, and lib
19:48:52miqlas-Hcan i set where they should go?
19:50:27miqlas-Hi see it is controlled in install script. should i define there something like "case haiku" ?
19:51:30Araq_miqlas-H: yes but keep in mind it's produced from a .tmpl file in tools/niminst
19:52:45dom96miqlas-H: What about software which doesn't support the Haiku file system, where is it installed?
19:53:03Araq_renesac: iterator allValues
19:53:20dom96We already have enough problems because of into /usr/bin, /usr/lib, /etc.
19:53:25dom96*of installation
19:53:29renesacoh, I was looking only at the procs
19:54:00*euantor quit ()
19:54:03*shodan45 quit (Quit: Konversation terminated!)
19:54:38miqlas-Hdom96: they have almost all the time some configure script. Our 'haikuporter' tool will provide them the correct folders trough --xxxdir (like bindir) options automatically.
19:55:01*yglukhov_ joined #nim
19:56:20dom96miqlas-H: what if it's a closed-source application? For example, on Unix systems it would typically be installed in /opt/applicationName
19:56:38philoSo I went looking around and found CountTable which does just what I need, but... http://pastebin.com/2RzEKMdd
19:57:54*yglukhov quit (Ping timeout: 276 seconds)
19:58:34Demosthe unix filesystem is such a mess
19:58:36renesacphilo: you probably want inc
19:58:44renesacthere is no add for CountTable I think
20:00:02philorenesac, thanks!
20:01:08philorenesac: still type mismatch
20:02:49*francisl joined #nim
20:03:56vktecShould I use `var tbl = newTable[string, int]` or `var tbl: Table[string, int]` or something else?
20:04:42renesacproc initCountTable[A](initialSize = 64): CountTable[A]
20:04:53renesacyou shoud use that proc
20:05:18renesacvar tbl = initCountTable[string]()
20:05:26vktecAh, thanks
20:05:38vktecIs the `()` necessary there?
20:05:49renesacprobably
20:05:59vktecOkay, thanks
20:06:50*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
20:08:54*aziz quit (Quit: Ex-Chat)
20:09:37philorenesac: ??
20:10:17renesacoops
20:10:31renesacI'm mixing up you two, philo and vktec
20:11:22vktec:)
20:12:15philovar transitions = CountTable[string]() seems to work... until I try is inc() or add() it, then typeMishMash
20:13:32renesacI get a SIGSEGV, no type mismatch
20:13:35renesac^^'
20:13:37dom96philo: you should use initCountTable
20:13:45miqlas-Hdom96: the author could change the install folder in his sources.
20:13:57renesacand yeah, you should use what I said vktec to use
20:14:26dom96miqlas-H: I'm sure there are times when that's not possible
20:14:46renesacit seems like one shouldn't call "inc" on non-existant keys...
20:14:55miqlas-Hthen we have a non-packaged directory structure
20:15:54renesacok, I don't know how to use that
20:16:31philodom96: initCountTable, still missmatch. I'm on ARMv7.. is that mucking this up?
20:16:47dom96philo: paste your code again
20:16:52renesacphilo: if you manage to discover how to use that countTable, pull requests are welcome
20:17:20renesacphilo: post a complete code, with the "chains" for example
20:17:56renesacpull requests with example usage
20:18:35philorenesac: http://pastebin.com/bQcwL2r1
20:20:03renesacyour import is incomplete
20:20:16renesacyou should import inc from tables too
20:20:22Araq_philo: from tables import CountTable, initCountTable # just use import tables
20:20:29renesacyeah
20:20:48Araq_Nim is not python, we use types, not scopes for protection
20:21:17Araq_even though most people don't understand it and blame us for "polluting" the namespaces and all that nonsense
20:22:03philobingo!
20:22:58philoAraq_ types for protection? Got a link for that?
20:23:04renesacAraq_: the major crictic that I saw is tht it is difficult to know where things came from w/o using a IDE
20:23:13renesacphilo: basically, overloading
20:24:08philorenesac: yeah, the tutorial talked about that, it chooses the proc with the right data types
20:24:09renesacthe language will know what proc to apply based on the type of its arguments
20:24:19renesacpython don't have that
20:25:31renesacwell, it has clases with methods
20:25:35renesac*classes
20:31:00Araq_renesac: yes but it's always hard to navigate without an IDE, so the whole point is moot
20:31:50Araq_and why would I *not* use an IDE? that's like not using shoes for walking. sure, I can do it, but most of the time I don't.
20:36:28renesacgit hub
20:36:33renesacreading code on your tablet
20:36:43renesacediting remotely in a server
20:36:58renesacno nimsugest support on your favorite editor..
20:37:21renesacreading code in a blog
20:37:22renesacetc
20:38:32renesacreading a tutorial/example
20:38:33renesacetc
20:40:54edub4rtAraq_: what is the "stack" gc? I was reading the code and found the option, I am benchmarking the asynchttpserver and used that gc, went from 80k from (refc) requests/s to 120k requests/s (stack)
20:41:40edub4rtnvm I found out, the mem keeped increasing upto 12GB, I think its just stacking the allocations
20:43:13edub4rtbut outperformed the others gc, which is odd because its keep allocating more and more
20:45:29deavmi_mobilewhen should one use
20:45:50deavmi_mobilethe discard keyword. is it for times when a value is returned but does not want to be used?
20:48:27def-deavmi_mobile: yes, among other uses
20:48:40deavmi_mobileokau
20:48:43deavmi_mobilethanks ;)
20:48:44def-deavmi_mobile: it's useful for procs returning an error code that you need to check
20:50:06*kingofoz quit (Read error: Connection reset by peer)
20:50:38*kingofoz joined #nim
20:55:46edub4rtdom96,def-: deep investigating asynchttpserver performance, you might find this interesting, I used kernel's perf to visualize where the process is using the most of the cpu, I've found out the major optimization issue too much allocation/desalocation while processing requests, as you can see in this screenshot http://storage6.static.itmages.com/i/16/0617/h_1466196551_6311064_60d86f27ae.png
20:56:08Araq_edub4rt: that's hardly news here :-)
20:56:16edub4rtthe screenshot was taken while a simple hello from asyncdispatcherhttp was processing 100k/s
20:56:44edub4rtasynchttpserver*
20:57:26Araq_edub4rt: I think we can patch async to use --gc:stack
20:57:32Araq_but I'm not sure
20:57:32edub4rtas you can see the first heavy method is rawalloc (which is from gc), third most is collectctbody (which is also from gc), then next ones rawdealloc, sweep etc
20:57:55dom96edub4rt: 'perf' looks like a cool command, but yeah we already know that :)
20:58:21dom96Unfortunately this is likely due to the allocation of Future's
20:58:53edub4rtmost of CPU is spent allocating/deallocating and in gc, things could be optimized by minimizing usage of allocation/deallocating
20:59:01Araq_allocate a region for every request, throw away the region after the request
20:59:15Araq_that's what --gc:stack allows
20:59:35dom96Araq_: so how do we get it to work?
20:59:38Araq_simple, effective, doesn't have to redesign async's API to minimize allocations
20:59:49Araq_but hey, what do I know.
20:59:57edub4rtdom96: perf is definitely a must have tool, you should try it, is simple to install and use "sudo apt-get install perf" then "perf top"
21:00:04dom96is it just a simple allocRegion() and deallocRegion() in the code? :P
21:00:13Araq_yes
21:00:21dom96any docs?
21:00:26Araq_no...
21:00:34dom96there is your problem :P
21:00:46Araq_"lack of time" is my problem.
21:01:05dom96But seriously, are these allocRegion procs at least defined somewhere like system or something?
21:02:32cheatfateioselectors.nim dont use alloc/dealloc :)
21:03:21cheatfateand generics usage resolves some alloc/dealloc in asyncdispatch
21:03:31cheatfatebut not Future allocations
21:03:56cheatfatebut we can make global futures storage...
21:04:37cheatfatebut we need at least Future.close() method
21:05:06Araq_caching futures is meh.
21:05:18*kingofoz quit (Read error: Connection reset by peer)
21:06:04*kingofoz joined #nim
21:07:38dom96Araq_: why?
21:08:04*cheatfate thinks Araq wants to make his own async state machine :)
21:08:35cheatfatebecause i'm too ignorant (C) Varrioint
21:08:47*mahasamoot quit (Ping timeout: 244 seconds)
21:08:55Araq_because you increase the lifetime of objects to infinite
21:10:04*philo quit (Ping timeout: 264 seconds)
21:10:04Araq_which means the GC doesn't collect for you anymore. you're managing the memory on your own then
21:10:15Araq_aka object pooling.
21:10:18cheatfateAraq_, yep, because we don't need GC
21:10:48Araq_do that for everything and worse case memory bounds are much much worse than for any other kind of allocation scheme
21:11:06Araq_*and the memory bounds are worse than ...
21:11:48Araq_but ok, fine, try it.
21:11:54dom96Meh, at this point parallelisation is more important.
21:12:39Araq_here is what we have:
21:13:21Araq_RC + M&S GC works great for games, but for async the RC part is essentially worthless and we're left with M&S doing the bulk of the work
21:13:54Araq_what's the cost of M&S? the marking of what is alive
21:14:11Araq_what do you do? you cache all objects, meaning much more things are alive
21:15:23Araq_so you pessimize the cost of a GC run
21:15:30Araq_but optimize the number of GC runs
21:16:10Araq_--> somebody needs to measure it.
21:16:11*polypus74 quit (Remote host closed the connection)
21:16:11*polypus quit (Remote host closed the connection)
21:19:11dom96I think it would make sense to write an efficient async http server on top of the `selectors` module.
21:19:34dom96At the cost of some niceness like async procs it would result in ultimate performance.
21:20:01cheatfatedom96, you are trying to achieve speed using old engine...
21:20:02*saml quit (Quit: Leaving)
21:20:38dom96cheatfate: Once I get time to properly review it, your ioselectors module will become the `selectors` module. Don't worry.
21:21:43cheatfatealso we need this https://github.com/h2o/picohttpparser and more modern version https://www.google.com.ua/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwj4r_D5_q_NAhUJEiwKHb7ACAAQFggnMAE&url=http%3A%2F%2Fblog.cloudflare.com%2Fimproving-picohttpparser-further-with-avx2%2F&usg=AFQjCNFzUOYYXsg8yHfZ8UTi8jw91GAcOA&sig2=_hCWvjDmZuiEcRwwoEQ9ug
21:21:44*Gonzih quit (Ping timeout: 272 seconds)
21:23:38*desophos joined #nim
21:24:03dom96Sure optimisations like that are good, but I think it's more important to implement missing functionality first.
21:24:33*endragor quit (Ping timeout: 240 seconds)
21:24:50dom96For example: asyncproc (asynchronous OS processes), fsmonitor (asynchronous monitoring of files/folders)
21:25:00dom96Also HTTP2 support in the our server
21:25:03dom96*in our
21:25:33dom96oh, and as far as benchmarks are concerned: if someone could benchmark the only websocket library that we have then that would be brilliant.
21:27:04*lazypenguin1 quit (Quit: Leaving)
21:37:34*Demos quit (Ping timeout: 252 seconds)
21:41:10*deavmi_mobile quit (Quit: Cheers all. Be good and don't do drugs.)
21:41:20*deavmi_mobile joined #nim
22:03:55miqlas-HBye Guys
22:06:06*miqlas-H quit (Quit: Vision[0.9.7-H-20140108]: i've been blurred!)
22:07:40*Matthias247 joined #nim
22:08:01*yglukhov_ quit (Remote host closed the connection)
22:08:39*Trustable quit (Remote host closed the connection)
22:10:35*yglukhov joined #nim
22:11:34*philo joined #nim
22:11:35cheatfatedoes anybody knows what is default calling convention for simple "extern int xxxxxx()" for gcc?
22:12:05*mahasamoot joined #nim
22:12:32*mostworst quit (Ping timeout: 250 seconds)
22:13:11Araq_cheatfate: __cdecl
22:13:31cheatfateAraq_, it looks like somebody of us wrong at least for windows
22:14:17cheatfatefor x64 platform it doesn't matter until your function is less than 4 arguments
22:14:50cheatfatei have constant SIGSEGV on calls to postgres.nim function in windows
22:14:54cheatfatewith mingw
22:15:01cheatfateand vcc is works
22:15:38Araq_well vcc might use stdcall
22:16:02Araq_dunno, you need to check postgre's source code and see what's the correct calling convention
22:18:44cheatfateAraq_, for some reason they don't declare any conventions
22:19:22Araq_really?
22:19:42Araq_shouldn't they have some knowledge about these things?
22:21:20Araq_whatever open the DLL in some editor and check the name mangling
22:21:41Araq_the name mangling tells you the calling convention, I hope
22:22:00cheatfatename mangling is only used by C++ code
22:22:52Araq_no, DLLs have it
22:23:00Araq__foobar@8
22:23:11Araq_means cdecl, 8 bytes on stack
22:23:23Araq_foobar@8 means stdcall, 8 bytes on stack
22:23:29Araq_or similar, check google
22:26:21Araq_bbs
22:26:30cheatfatethere no mangled names in libpq.dll
22:32:18Araq_Production releases of PostgreSQL for Windows are generally built using MicroSoft's commercial compilers
22:32:26Araq_from https://wiki.postgresql.org/wiki/Building_With_MinGW
22:32:41cheatfateAraq_, i have found a problem minute ago
22:33:02cheatfateThere was problem with tracing file... for some reason it not working in windows
22:33:15cheatfateand causes SIGSEGV inside of PQSendQueryPArams
22:33:28cheatfateso i disabled tracing file and everything is goes fine
22:33:44cheatfatetracing file uses nim's `File`
22:34:01cheatfateso why it works properly with vcc and not gcc
22:34:43cheatfatemy addRead and addWrite for windows works as expected
22:45:16Araq_so ... I looked it up
22:45:20Araq__foo # cdecl
22:45:30Araq__foo@8 # stdcall
22:45:41Araq_@foo@8 # fastcall
22:51:34cheatfateAraq_, its not a standard for DLL
22:52:20cheatfatelibpq.dll as kernel32.dll dont have mangled names
22:54:13*Matthias247 quit (Read error: Connection reset by peer)
23:01:32*brson joined #nim
23:03:16*brson quit (Client Quit)
23:03:22*akaisora_ quit (Read error: Connection reset by peer)
23:04:07*sdw joined #nim
23:10:07*deavmi_mobile quit (Read error: Connection reset by peer)
23:15:09*deavmi_mobile joined #nim
23:21:20*ObjPas joined #nim
23:21:21cheatfateAraq_, i'm still don't understand genSym()
23:22:03cheatfategenerates a fresh symbol that is guaranteed to be unique
23:22:48cheatfatewhat does it mean unique, unique in block?
23:24:24*ObjPas quit (Client Quit)
23:27:18*elrood quit (Quit: Leaving)
23:38:03cheatfateAraq_, is it possible to convert macro's argument of type like int, string to nimnode?
23:39:36cheatfateso i can use it value in generation
23:39:37cheatfate?
23:57:13Araq_cheatfate: it means unique.
23:57:20Araq_in ev
23:57:33Araq_*for any block
23:59:26cheatfateso var paramTypes = genSym(nskVar, "param") var paramValues = genSym(nskVar, "param") so paramTypes and paramValues will have unique names?