<< 07-01-2017 >>

00:01:56krux02yes efficient compiler caches would be nice, for example when I compile my project, it would be nice if the compiler could save the state when all the imports are processed, and just come back to exactly this state when recompilation is invoked
00:02:04krux02I know it's a bit more complicated than that
00:02:15krux02and I am quite happy with the compilation speed
00:02:25*derlafff quit (Remote host closed the connection)
00:03:06*derlafff joined #nim
00:03:27Araqthat's what --symbolFiles do, but I need to rewrite this part, more or less
00:03:42krux02I just imagine this to be implemented with fork, and the fork doing nothing and waiting for a command line invocation of nimc
00:04:20Araqhmm?
00:04:57krux02don't worry too much, that's pretty dirty implementation and would only work on linux as far as I know
00:05:17krux02but with fork you can get on linux an almost identical copy of a process
00:05:33AraqI know what fork does.
00:06:31krux02It really is not that important, because that idea just came into my head
00:06:44krux02and it is not very well thought through
00:07:32krux02and it does not cover proper handling of files that actually change when the standard library has changes
00:15:41*Trustable quit (Remote host closed the connection)
00:17:05*devted quit (Quit: Sleeping.)
00:18:54*Gilga quit (Ping timeout: 272 seconds)
00:27:08*def-pri-pub quit (Quit: leaving)
00:27:38*def-pri-pub joined #nim
00:34:15def-pri-pubQustion about the nimgrep tool: is it only a simple text search-and-replace tool? Or can it refactor specific things in a Nim source file/ project directory?
00:35:37dom96only search and replac
00:35:38dom96e
00:35:52def-pri-pubah. Are there any more complex refactoring tools out there?
00:44:49krux02def-pri-pub: there is nothing complex thar transforms source code representations
00:56:44*jinshil joined #nim
01:00:38*couven92 quit (Quit: Client disconnecting)
01:01:18krux02Araq: the fact that I cannot do this on ast nodes is bugging me a lot lately: let x = arg[0][0][2][2]; for n in nodeIter(): x.add(n)
01:04:11krux02I am very close to write my own reference to a NimNode that is a seq[int] internally just to work around this bug
01:05:01*yglukhov joined #nim
01:09:38*yglukhov quit (Ping timeout: 248 seconds)
01:14:25*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
01:16:31krux02Araq: and a fast `tail` implementation on `openarray` would also be great
01:18:14*bjz joined #nim
01:18:26Araqkrux02: you could also fix the VM instea
01:18:46dom96http://xkcd.com/1782/
01:46:08*nsf quit (Quit: WeeChat 1.6)
01:52:44*yglukhov joined #nim
01:56:53*yglukhov quit (Ping timeout: 240 seconds)
02:04:34*vlad1777d quit (Remote host closed the connection)
02:29:37*brson quit (Quit: leaving)
02:35:48*pregressive quit (Remote host closed the connection)
02:39:49*chemist69 quit (Disconnected by services)
02:39:54*chemist69_ joined #nim
02:52:02*krux02 quit (Quit: Leaving)
02:58:19*jinshil quit (Quit: client terminated!)
03:08:20*pie__ joined #nim
03:48:54*pie__ quit (Changing host)
03:48:54*pie__ joined #nim
04:31:59*pregressive joined #nim
04:35:00*arnetheduck joined #nim
04:42:17*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
04:43:53*chemist69_ quit (Ping timeout: 240 seconds)
04:48:31*chemist69 joined #nim
04:55:49*ioreth joined #nim
04:56:27*ioreth left #nim (#nim)
05:18:42def-pri-pubAnother question: When I have a complex type/object, are they passed by reference or value in a proc's argument?
05:20:18def-pri-pube.g. the `Matrix3d` object in `basic3d`, are all of it's fields copied when it's being called onto a `proc`?
05:24:58*arnetheduck quit (Ping timeout: 246 seconds)
05:27:54*bjz_ joined #nim
05:28:58*bjz quit (Ping timeout: 258 seconds)
05:39:11*space-wi_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
06:23:37*space-wizard joined #nim
06:37:38*bjz_ quit (Ping timeout: 248 seconds)
06:37:46*bjz joined #nim
06:48:59*def-pri-pub quit (Quit: leaving)
07:19:31*GustavoLapasta joined #nim
08:10:57*space-wizard quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:26:35*ARCADIVS joined #nim
08:47:31*chemist69 quit (Ping timeout: 240 seconds)
08:48:22*chemist69 joined #nim
08:50:48*jinshil joined #nim
09:42:08*byte512 quit (Ping timeout: 255 seconds)
09:52:45*Trustable joined #nim
09:57:43*Trustable_2 joined #nim
09:57:49*Trustable_2 quit (Remote host closed the connection)
10:07:35*Matthias247 joined #nim
10:09:32*nsf joined #nim
10:32:36ftsf_hmm how can i get a random element of a set?
10:50:19*cheatfate quit (Read error: Connection reset by peer)
10:50:43ftsf_hmm can't filter a queue =(
10:54:46*Gilga joined #nim
10:57:54*couven92 joined #nim
11:06:06Araqthere is a PR for that iirc
11:19:45ftsf_cool, cool, worked around it for now
11:19:56ftsf_nearly finished another game \o/
11:21:33ftsf_http://static.impbox.net/boxen2/boxen.mp4
11:47:17*cheatfate joined #nim
11:50:14GilgaHello, I'm new to nim and still am learning. I just wanted to ask Macros. How powerful are they? As far as I'm understanding with Macros you can expand the language. Can you for instance add pattern matching to the language? What about list comprehension?
11:50:32GilgaI haven't gotten too far into Nim, so this question is out of pure curiousity
11:50:39ftsf_Gilga, list comprehension has been done
11:51:08ftsf_tbh, i i haven't used macros at all and i'm still very productive in nim.
11:51:20ftsf_(haven't created my own macros that is)
11:51:55*gokr joined #nim
11:51:57GilgaNice, then it's quite powerful. I'd just like to know on an inntuitive level how powerful macros can get.
11:52:58def-Gilga: https://github.com/nim-lang/Nim/blob/master/lib/pure/future.nim#L128
11:53:04GilgaDon't get me wrong, I'm not saying that you have to use Macros. Nim seems like a very expressive language without them. I'd just like to know more about them as I've never really gotten involved into them.
11:53:10def-Gilga: Pattern matching: http://www.drdobbs.com/open-source/nimrod-a-new-systems-programming-languag/240165321
11:53:52Gilgahanks for the links, def.
11:54:03Gilgaand for the answers ftsf
11:55:05ftsf_i should probably start trying to think with macros
11:56:32def-ftsf_: I'd say always try to solve problems without macros first. they are too powerful for many problems
11:57:07ftsf_hmm good point
12:04:36*Snircle joined #nim
12:13:13*gangstacat quit (Ping timeout: 240 seconds)
12:18:38*gangstacat joined #nim
12:33:15*gangstacat_ joined #nim
12:34:11*gangstacat_ quit (Client Quit)
12:34:33*gangstacat quit (Ping timeout: 240 seconds)
12:37:30*gangstacat joined #nim
12:38:28*gangstacat quit (Client Quit)
12:40:20*gangstacat joined #nim
12:45:00*mat4 joined #nim
12:45:25mat4hello
12:46:29ftsf_hi mat4
12:50:07mat4does there exist an option to disable garbage collection with the current Nim version ?
12:50:46dom96--gc:none
12:50:47ftsf_yep, --gc:none
12:50:58ftsf_=( too slow
12:54:14mat4no I mean temporary for specific source sequences
12:55:08dom96http://nim-lang.org/docs/system.html#GC_disable,
12:55:27dom96ftsf_: That looks good. Inspired by one of your previous games? It looks familiar
12:56:01ftsf_dom96, yeah, based on an old android game of mine made in lua, the original code is a horrid mess and i can't bare to look at it again
12:59:57ftsf_trying out nim-chipmunk
13:03:05*couven92 quit (Quit: Client disconnecting)
13:12:19*byte512 joined #nim
13:21:56mat4dom96: sorry, I would require to temporary disable GC completly, not only the mark-and-sweep collector
13:24:12*enthus1ast joined #nim
13:29:04*mat4 quit (Quit: Verlassend)
13:30:44*beaumonta is now known as abeaumont
13:31:02*enthus1ast quit (Ping timeout: 245 seconds)
13:31:30*gokr quit (Read error: Connection reset by peer)
13:35:53*confundus joined #nim
13:42:19*jinshil quit (Remote host closed the connection)
13:50:47*confundus quit (Quit: confundus)
14:06:15*fredrik92 joined #nim
14:13:37*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
14:20:22*fredrik92 quit (Quit: fredrik92)
14:27:40*subsetpark joined #nim
14:31:02*byte512 quit (Ping timeout: 245 seconds)
14:31:48*Trustable quit (Ping timeout: 248 seconds)
14:32:18*Trustable joined #nim
14:47:48*nsf quit (Quit: WeeChat 1.6)
14:49:15*dddddd joined #nim
14:51:44*confundus joined #nim
15:15:25*vlad1777d joined #nim
15:19:37*Parashurama joined #nim
15:21:13*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
15:24:33ParashuramaIs there any way a make a template return value discardable?
15:25:00ParashuramaI use this for now :
15:25:00Parashuramaproc makeDiscardable[T](a: T): T {.discardable, inline.} = a
15:25:00Parashuramatemplate foo(): bool =
15:25:18Parashurama makeDiscardable(true)
15:35:43*gangstacat quit (Quit: Ĝis)
15:35:54*yglukhov joined #nim
15:40:28*gangstacat joined #nim
15:43:59*confundus quit (Quit: confundus)
15:44:46*NimBot joined #nim
15:45:09*NimBot joined #nim
15:45:34*NimBot joined #nim
15:46:04*NimBot joined #nim
15:46:21*NimBot joined #nim
15:49:37*confundus joined #nim
15:53:03*Parashurama quit (Quit: Leaving.)
15:53:21*Parashurama joined #nim
16:15:42*yglukhov quit (Remote host closed the connection)
16:48:14FromGitter<Varriount> Gilga: Nim's macros are essentially just procedures that construct an abstract syntax tree, so they're pretty powerful.
16:49:32FromGitter<Varriount> def-pri-pub: Internally, unless a type/argument has been annotated with the bycopy pragma, all arguments are passed via pointer
16:50:30FromGitter<Varriount> The semantics must still slow for the possibility of copying though, especially for object types
16:51:20*gokr joined #nim
16:51:39FromGitter<Varriount> That being said, you should also be aware of assignment semantics: http://forum.nim-lang.org/t/2665#16487
16:52:01*chemist69 quit (Ping timeout: 258 seconds)
16:52:23FromGitter<Varriount> ^ Good explanation for anyone new to lower-level programming
16:52:36*chemist69 joined #nim
16:54:44*space-wizard joined #nim
16:55:14*gokr quit (Read error: No route to host)
16:56:34FromGitter<Varriount> mat4: Why do you need to disable the garbage collector?
17:03:06*pie__ quit (Ping timeout: 240 seconds)
17:19:47*nsf joined #nim
17:28:08*confundus quit (Quit: confundus)
17:32:28*dddddd quit (Remote host closed the connection)
17:32:42*def-pri-pub joined #nim
17:33:37def-pri-pubI asked this in the IRC last night but I never got an answer for it, so here it is again:
17:33:40def-pri-pub05:18:42 def-pri-pub Another question: When I have a complex type/object, are they passed by reference or value in a proc's argument?
17:33:43def-pri-pub05:20:18 def-pri-pub e.g. the `Matrix3d` object in `basic3d`, are all of it's fields copied when it's being called onto a `proc`?
17:33:46def-pri-pubwhopps.
17:33:52def-pri-pubAnother question: When I have a complex type/object, are they passed by reference or value in a proc's argument?
17:33:59def-pri-pube.g. the `Matrix3d` object in `basic3d`, are all of it's fields copied when it's being called onto a `proc`?
17:53:52*Gilga quit (Ping timeout: 240 seconds)
17:58:16FromGitter<Varriount> def-pri-pub: As I said, they aren't copied
17:58:36FromGitter<Varriount> Not unless you mark the type with the bycopy pragma
17:59:08FromGitter<Varriount> If you look at the C source code, you'll notice that arguments are always pointers
18:00:19FromGitter<Varriount> The pointer either pointing to the stack (in the case of object and var parameters) or to the heap.
18:00:49*sarlalian quit (Ping timeout: 258 seconds)
18:03:07*sarlalian joined #nim
18:31:13*Jesin quit (Quit: Leaving)
18:31:53def-pri-pubso what about in the case of a paramter that is a `ref object`? When it enters the scope of the function, will the reference count increase by one, then when it exits, decrease by one?
18:36:14*arnetheduck joined #nim
18:37:10*Jesin joined #nim
18:46:24FromGitter<Varriount> Semantically, yes
18:47:16*arnetheduck quit (Ping timeout: 248 seconds)
18:47:41FromGitter<Varriount> Def-pri-pub: although whether the reference is actually incremented depends on the garbage collector
18:48:09def-pri-pubOkay, thanks. I'm a little confused on the internals of Nim. Does this only apply to the C like targets? Or JS as well?
18:49:35FromGitter<Varriount> It depends on the backend
18:50:29def-pri-pubgotcha
18:50:34*Gilga joined #nim
18:50:46FromGitter<Varriount> def-pri-pub: If you're worried about reference counting being costly with regards to performance, it's not. Especially not with the default garbage collector
18:51:08FromGitter<Varriount> I mean, refcounting is what smartpointers in C++ use
18:51:37Araq" Internally, unless a type/argument has been annotated with the bycopy pragma, all arguments are passed via pointer" no, the compiler picks the most efficient parameter passing mode
18:51:49Araqand it has been this way since day 1.
18:51:59FromGitter<Varriount> ^ I stand corrected
18:53:07FromGitter<Varriount> Araq: Would you be happier if I said that *most* arguments are passed by pointer, internally?
18:53:08def-pri-pubSo compiler knows best?
18:53:54FromGitter<Varriount> def-pri-pub: Yes. And if it offers to do your taxes for you, let it.
18:54:35ParashuramaAraq: hey, can you look at earlier today in IRC I asked a question about template with discardable return value
18:55:32*hendi joined #nim
18:56:05AraqParashurama: yeah, that's not possible
18:56:20Araqwhat's the use case?
18:56:52ParashuramaIt is an optimization move proc -> template
18:57:20Parashuramaalso for debugging since instaiationInfo only works in templates
18:58:10Araqwhy is it discardable?
18:58:19Parashuramabut I can manage with a returning a proc like makeDiscardable[T](a: T): T {.discardable, inline.} = a
18:58:39FromGitter<Varriount> Parashurama: Why not use the inline pragma?
18:59:12Parashuramathe return value is just a bool, to check if operation was succesful.
18:59:36ParashuramaVarriount: see instanciationInfo in system.nim to get line info.
18:59:47*chemist69 quit (Ping timeout: 245 seconds)
19:00:00Parashuramabut the return value can be safely ignored.
19:00:09*chemist69 joined #nim
19:02:07ParashuramaAraq: btw would "when not (defined(nimvm) or defined(js) or defined(nimdoc)):" be sufficient to guard importc proc with header pragma
19:03:41*Amun_Ra quit (Ping timeout: 258 seconds)
19:05:27AraqParashurama: maybe, what about the LLVM backend though?
19:10:38*Amun_Ra joined #nim
19:14:04*Gilga quit (Ping timeout: 255 seconds)
19:25:03*yglukhov joined #nim
19:25:10*yglukhov quit (Remote host closed the connection)
19:31:55ParashuramaAraq: yes, I'm not sure what is defined by nimllvm. I think emscriptem support header pragma
19:35:15*yglukhov joined #nim
19:39:20ParashuramaThe goal being at the moment add support for memchr in strutils.find for supported platforms & systems.
19:49:16Araqah cool
19:53:24*ARCADIVS quit (Quit: ARCADIVS)
19:54:10ParashuramaAraq: Where do you think I could add compiler builtins like __builtin_clz, popcount and things like that.
19:55:17*odc_ joined #nim
19:56:20Araqdepends on the implementation
19:56:43Araqbut we still lack a intrisics.nim module ;-)
19:57:18def-pri-pubAraq: I'm working on some bindings for the HTML5 Canvas tag and drawing on it, for the JS target. When I'm done with it, would you be interested in merging it into the Nim repo?
19:57:21def-pri-pubhttps://gitlab.com/define-private-public/HTML5-Canvas-Nim
19:57:58Araqno, sorry. that should be a nimble package
19:58:09def-pri-pubgothca (it already is)
19:58:13ParashuramaAraq: intrinsics.nim seem like a good idea, and also eventually a simd module with SSE and NEON intrinsics
19:58:20Araqwe could make it an official nimble package eventually.
19:59:05ParashuramaAraq: you mean for the intrinsics module?
19:59:09Araqso ... do we want a risky merge of the concepts branch in 0.16?
19:59:23AraqParashurama: no, I meant the canvas
19:59:51Araqrelease 0.16 only got the code generation improvements
19:59:55ParashuramaOkay, for concept branch what the difference with curent impl
19:59:57def-pri-pubSounds cool to me. Are there any plans to make the OS module work for the JS target? I know that browser != operating system, but there are something things that depend on it that I want for the js target. (e.g. HttpClient)
20:00:33Araqdef-pri-pub: that's pretty hopeless. you could try to make ospaths work for JS
20:00:58Araqbut stuff like HttpClient needs to be reimplemented for JS afaict
20:01:19*dddddd joined #nim
20:01:57def-pri-pubI'll look into it eventually. Yeah, I'm aware that HTTPClient does need to use the JS's XMLHttpClient. I was thinking about working on that and submitting a patch, but then I saw HttpClient is dependant upon the os module.
20:02:28Araqthat doesn't mean much. os.nim creeps into everything
20:02:57def-pri-pubAlso, have you gotten a change to look at this PR yet? I know it's a little trivial, but I think it's important to mention in the docs: https://github.com/nim-lang/Nim/pull/5181
20:03:01AraqI doubt the http client uses e.g. setting of file permissions
20:03:45Araqdef-pri-pub: meh, I don't like the wording
20:04:12def-pri-pubIs there some better wording I could use?
20:05:13def-pri-pubEh, I'll think of something and update the PR.
20:05:26*def-pri-pub is now known as def-pri-pub|afk
20:05:29def-pri-pub|afk(lunch time)
20:37:57*yglukhov quit (Remote host closed the connection)
20:38:14*yglukhov joined #nim
20:44:14*def-pri-pub|afk is now known as def-pri-pub
20:45:39Araqdef-pri-pub: too late, I merged it manually
20:49:29def-pri-pubdamn.
21:03:51*Sembei joined #nim
21:33:01def-pri-pubFor the JS backend, what Nim type turns into a JavaScript array?
21:34:30def-pri-pubWould It be seq since the JS array is mutable?
21:35:50Araqseqs and arrays are both mapped to JS arrays
21:40:00def-pri-pubokay.
21:59:29*GustavoLapasta quit (Quit: Leaving)
22:05:42ParashuramaAraq: hey, is there a way to check if nim version has `compile_option` Option(
22:06:13Parashuramasomething like: when compiles(compileOtion("option")):
22:06:34Parashuramabut the previous expression crashes
22:06:50AraqI thnk you can only check for this via a version check
22:07:10ParashuramaThats what I though, oh well, thaks anyway.
22:07:46Parashuramabtw portable compiler intrinsics are harder that I thought
22:07:50Parashurama:)
22:09:59ParashuramaI am making some progress, but sometime even compiler intrinsics have awful performance .
22:10:48*MyMind joined #nim
22:12:43*Sembei quit (Ping timeout: 255 seconds)
22:42:49AraqParashurama: well if it were easy, somebody would have done it already :-)
22:43:21ParashuramaAt least we already have Hamming weight function in math. thats something
22:44:56ParashuramaI think the module will be focusing on bit instrinsics, most others are kinda random.
22:46:12*nsf quit (Quit: WeeChat 1.6)
22:50:03*Parashurama left #nim (#nim)
22:51:51*gangstacat quit (Quit: Ĝis)
22:55:27*Salewski joined #nim
22:56:24SalewskiParashurama, yes intrinsics/builtin support would be nice.
22:57:47SalewskiI recently tested popcnt mentioned in a forum post, works nice with gcc, but portability may be difficult.
22:58:29SalewskiFor popcount there is also a pull request.
22:58:35*devted joined #nim
22:59:36SalewskiIt would be nice if it would be possible to code stuff like xxhash or clhash in pure Nim.
23:00:35SalewskixxHash is already available for many other languages than C.
23:01:42SalewskiWe may need 128 bit data types too, I think I have seen that in the clHash C code.
23:03:15Salewskihttp://programmingzen.com/so-you-want-your-programming-language-to-be-popular/
23:03:21SalewskiBye.
23:03:26*Salewski left #nim (#nim)
23:09:48*pregressive quit (Remote host closed the connection)
23:12:07*yglukhov quit (Remote host closed the connection)
23:19:00*Matthias247 quit (Read error: Connection reset by peer)
23:35:28cheatfateAraq, it looks like macos before Leopard don't have api to set thread affinity
23:35:44AraqI noticed.
23:35:50AraqI disabled it for osx
23:38:11cheatfatecould we check for macos version?
23:39:48Araqyeah but that would be a runtime check
23:40:01cheatfatei think this can be used https://github.com/witheve/cluster/blob/464e3d3b64c629639e82117e34fbc2f6dc8bba34/csrc/unix/darwin/thread.c
23:40:52Araqbloat, bloat, bloat everywhere :P
23:41:06Araqwho cares about thread affinity on shitty osx
23:41:37cheatfatedom96 just created issue in my `wanted` about thread affinity :)
23:41:49Araqdo you use pinToCpu?
23:42:18cheatfateyep
23:42:33Araqso close the bug, stdlib was fixed
23:42:43cheatfateand everything is works?
23:42:56Araqit's a nop for osx now
23:43:20Araqso your code compiles and works but it might be slower
23:44:26cheatfatedom96, does it works for you?
23:48:22*vlad1777d quit (Quit: Leaving)