<< 23-08-2017 >>

00:01:08FromGitter<Varriount> Anyone know the term for all nodes in a graph that aren't roots?
00:04:20*oprypin quit (Quit: Bye)
00:14:28*Matthias247 quit (Read error: Connection reset by peer)
00:18:58*BitPuffin quit (Read error: Connection reset by peer)
00:20:44*def-pri-pub joined #nim
00:20:49subsetparkChildren?
00:26:15FromGitter<Varriount> subsetpark: Usually that's taken as 'immediate children' of a parent node. I was wondering if there was something to mark all children, grandchildren, etc.
00:28:27TheManiacI've been having the same nomenclature debate with myself too
00:28:36TheManiacyou have leaves and... nodes? branches?
00:28:41TheManiacterminals and non-terminals?
00:28:52FromGitter<ephja> thingies
00:31:29TheManiacwikipedia suggests root, internal and leaf nodes, but doesn't seem satisfying somehow
00:35:52*itseris joined #nim
01:09:03*Nobabs27 quit (Quit: Leaving)
01:26:05*def-pri-pub quit (Quit: Lost terminal)
01:37:54*chemist69 quit (Ping timeout: 255 seconds)
01:42:32*Nobabs27 joined #nim
01:47:57*Jesin quit (Quit: Leaving)
01:51:52*chemist69 joined #nim
02:31:25FromGitter<codenoid> hi, i wanna ask something, what is the difference between sidekiq and rabbitmq ?
02:41:22*yglukhov joined #nim
02:45:53*yglukhov quit (Ping timeout: 248 seconds)
02:49:14*def-pri-pub joined #nim
03:37:28*endragor joined #nim
03:37:54*endragor quit (Remote host closed the connection)
03:39:32*endragor joined #nim
03:44:48*Xe quit (Ping timeout: 255 seconds)
03:48:42*def-pri-pub quit (Quit: leaving)
03:51:54*Xe joined #nim
04:17:30*dddddd quit (Remote host closed the connection)
04:24:14*Yardanico joined #nim
04:27:24FromGitter<Varriount> @codenoid Well, a quick search suggests that Sidekiq is for general task dispatching, while rabbitmq is for message passing.
04:37:04*ofelas joined #nim
04:43:21*yglukhov joined #nim
04:48:34*yglukhov quit (Ping timeout: 246 seconds)
04:52:48*arnaud2 quit (Ping timeout: 248 seconds)
05:02:05*Shoozza quit (*.net *.split)
05:02:05*euantor quit (*.net *.split)
05:02:05*subsetpark quit (*.net *.split)
05:03:50*subsetpark joined #nim
05:04:27*d10n quit (Ping timeout: 260 seconds)
05:05:21*mahsav quit (Ping timeout: 240 seconds)
05:05:37*mahsav joined #nim
05:07:00*d10n joined #nim
05:07:00*d10n quit (Changing host)
05:07:00*d10n joined #nim
05:07:58*Nobabs27 quit (Quit: Leaving)
05:11:40*Yardanico quit (Ping timeout: 276 seconds)
05:19:31*rauss quit (Quit: WeeChat 1.9)
05:23:29*Yardanico joined #nim
05:26:22*Vladar joined #nim
05:28:09*Shoozza joined #nim
06:19:27*ldlework quit (Ping timeout: 246 seconds)
06:21:48*ldlework joined #nim
06:21:48*ldlework quit (Changing host)
06:21:48*ldlework joined #nim
06:25:14*Yardanico_ joined #nim
06:26:52*nsf joined #nim
06:39:06*Yardanico quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com ))
06:39:21*Yardanico_ quit (Quit: Leaving)
06:39:35*Yardanico joined #nim
07:00:25*euantor joined #nim
07:00:42*euantor is now known as Guest80731
07:06:34ZevvIs parseopt2 preferred over parseopt?
07:08:09Zevvdom96: where do I go with comments on the book?
07:08:38Yardanicohere, or nimlang forum?
07:08:43Yardanicothere are also forums on manning
07:08:51Yardanico(publisher of the book)
07:09:32Zevvdom96: sect 2.1.1 on page 23 mentions stropping, and refers to section 1.2 to learn more
07:10:48Zevvthat should be section 2.2.2
07:11:32Zevvindex reference of stropping only points to page 23 instead of 33
07:14:45Yardanicowell there's no way to edit finished book (because it's printed already) :)
07:15:11ZevvThere will be new revisions probably
07:15:13Yardanicohmm, manning has its own professional editors, how they didn't spot this?
07:15:13Yardanicohm
07:26:04*endragor quit (Remote host closed the connection)
07:31:58*Matthias247 joined #nim
07:40:57YardanicoHow to use "unittest" module to compare float values?
07:40:58Yardanicouse round?
07:41:39*yglukhov joined #nim
07:42:45*scriptum quit (Quit: Leaving)
07:45:09*nattefrost joined #nim
07:53:29*scriptum joined #nim
08:05:31*oprypin joined #nim
08:11:02*PMunch joined #nim
08:16:28*endragor joined #nim
08:19:38FromGitter<dom96> Zevv: there is an errata on the Manning forum. Already includes this.
08:20:13FromGitter<dom96> It's difficult to catch every mistake.
08:20:51*endragor quit (Ping timeout: 240 seconds)
08:25:38*Arrrr joined #nim
08:25:38*Arrrr quit (Changing host)
08:25:38*Arrrr joined #nim
08:26:52*scriptum quit (Quit: Leaving)
08:29:36Yardanicoalso it's very easy to implement some simple python functions in Nim: print(int(str(int(input("Enter your number - ")))) + 3)
08:29:43Yardanicothis works with a couple of templates/procs
08:30:06YardanicoI use int to str to int to check if it works correctly
08:30:24*yeeve joined #nim
08:30:29*couven92 joined #nim
08:31:12Yardanicobut I think I'll need to create a macro for "print" to support all arguments
08:31:40Yardanicobecause it has variable number of objects and then some print-specific arguments
08:35:04couven92Uhm, Araq? Concerning `alignLeft` why does that belong into unicode? That's like saying all of strutils should be in unicode?
08:35:30couven92I can certainly make a unicode variant of `alignLeft` in addition, wouldn't that make more sense?
08:38:44*Guest80731 is now known as euantor
08:39:02*euantor quit (Changing host)
08:39:02*euantor joined #nim
08:45:51*kunev quit (Ping timeout: 240 seconds)
08:46:07*vlad1777d joined #nim
08:48:54*kunev joined #nim
08:54:29*endragor joined #nim
08:54:29*endragor quit (Remote host closed the connection)
08:55:19*endragor joined #nim
08:58:16*nhywyll joined #nim
09:01:08*jinshil quit (Quit: Good-bye!)
09:04:50Zevvdom96: ok thanks
09:15:32*dom96|w joined #nim
09:16:49couven92how do you properly do Flag values that can be used as int bitvalues in importc functions?
09:17:09couven92`set[MyEnum]` does not really do the trick for me...
09:17:54couven92https://play.nim-lang.org/?gist=ae3238b4480047f9e8bf67f51eb72260
09:19:00couven92is defining a `distinct int32` and then implementing the set operations really the best option?
09:25:16*BitPuffin|osx joined #nim
09:25:34ZevvI have a file descriptor leak in newAsyncHTTPClient
09:26:17Zevvow wait it needs an explicit close()
09:26:18Zevvsilly me
09:38:54Yardanicowould it be possible to check if string contains URL with "pegs" module?
09:54:06flyxYardanico: you mean like this https://github.com/flaviut/nim-misc/blob/master/url_parse.nim
09:56:52Yardanicoflyx, well yeah, but in my case "vk.com" needs to be a "valid" url too
09:57:02Yardanico(I just want to filter out all links from messages)
09:57:24flyxwell you can of course modify it to fit your needs
09:57:32flyxby making the scheme optional for example
10:07:26dom96|wYardanico: see how NimBot does it
10:09:04Yardanicodom96|w, it just matches if there's nim-lang/nim in string
10:09:10Yardanicobut I need to filter out ANY url :)
10:09:18Yardanico(I mean ignore message if it has any urls in it)
10:10:30dom96|woh it uses regex, never mind https://github.com/nim-lang/nimbot/blob/master/src/irclogrender.nim#L27
10:12:29dom96|wIt's about time somebody wrote a pure Nim re implementation
10:12:45Yardanicoalso
10:12:52Yardanicothere's a one strange URL I found on the internet
10:12:54Yardanicohttp://ai
10:12:56Yardanicothis is it
10:13:02Yardanicothis is a VALID url?
10:15:21FromGitter<gogolxdong> Is there any gui lib in nim?
10:15:38Yardanicoyes, a couple of them
10:15:44Yardanicomostly they're bindings to other libraries
10:15:58Yardanicoui, wxnim, iup
10:16:03FromGitter<gogolxdong> recommendation?
10:16:19Yardanicowell there's actually one cool gui library - nimx
10:16:24Yardanicoit uses sdl2 + opengl
10:16:36Yardanicoand works in windows/linux/mac/android/browser
10:16:58Yardanicogogolxdong: https://github.com/yglukhov/nimx
10:17:13FromGitter<gogolxdong> I used nimx with compile error
10:17:37FromGitter<gogolxdong> `view_event_handling.nim(8, 8) Error: method is not a base`
10:17:51Yardanicowhat nim version did you use?
10:17:58FromGitter<gogolxdong> 1) 17
10:19:16Yardanicohm
10:19:50Yardanicogogolxdong: works for me
10:19:59Yardanicomaybe you've tried to compile editor?
10:21:17FromGitter<gogolxdong> compile on windows
10:21:47Yardanicowell maybe you can try with nim devel?
10:24:46flyxYardanico: well http://localhost is also a valid URL
10:24:51FromGitter<gogolxdong> Yes, how to compile nim from source in windows?
10:25:06*ShalokShalom_ joined #nim
10:28:21*ShalokShalom quit (Ping timeout: 240 seconds)
10:30:47*ShalokShalom_ is now known as ShalokShalom
10:34:58*arnetheduck joined #nim
10:37:29FromGitter<gogolxdong> I'm joking,but it doesn't work out.
10:40:41*Yardanico quit (Read error: Connection reset by peer)
10:41:07*Yardanico joined #nim
10:41:12*Matthias247 quit (Quit: Matthias247)
10:45:32*nattefrost quit (Ping timeout: 246 seconds)
10:46:19*nattefrost joined #nim
10:47:57FromGitter<Smaehtin> @gogolxdong I use https://github.com/dom96/choosenim - it "installs" Nim by downloading and building the sources
10:53:24*Matthias247 joined #nim
10:56:12*nattefrost quit (Ping timeout: 260 seconds)
10:56:27*nattefrost joined #nim
10:57:20FromGitter<gogolxdong> Yes,I saw Araq argued with the name of choosenim or picknim without looking into further.
10:59:51*Arrrr1 joined #nim
10:59:51*Arrrr quit (Disconnected by services)
11:00:32*haha_ joined #nim
11:02:41*Arrrr1 quit (Client Quit)
11:12:31*mahsav quit (Ping timeout: 248 seconds)
11:13:39*mahsav joined #nim
11:14:40FromGitter<gogolxdong> (https://files.gitter.im/nim-lang/Nim/XOUi/image.png)
11:23:43Yardanicogogolxdong: you have gcc in path
11:23:54Yardanicoit conflicts with mingw that choosenim installs
11:24:28YardanicoI suggest you to download choosenim precompiled version :)
11:25:30FromGitter<gogolxdong> got it , I downloaded nim binary for windows with version 0.17, turned out same.
11:26:33Yardanicoyou can remove your gcc from path
11:26:42Yardanicoit seems that your gcc is 64-bit
11:27:56*nhywyll quit (Quit: nhywyll)
11:28:35FromGitter<gogolxdong> what's the difference between precompiled nim binary and the nim compiled by choosenim?
11:35:07*vlad1777d_ joined #nim
11:35:27*vlad1777d quit (Ping timeout: 248 seconds)
11:36:06*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
11:36:48FromGitter<ephja> Yardanico: you can check if two floating point values are equal enough by doing something like this: "abs(a-b) < 0.00001"
11:36:59Yardanicoah, thanks!
11:42:04*haha_ quit (Quit: haha_)
12:00:55FromGitter<ephja> couven92: I think it works if you change the enumerators from `1 shl x` to `x`
12:02:12couven92@ephja: ? Why? Those shift statements are to set specific bits...
12:03:15couven92`1 shl 0` -> `0b0000_0000_0000_0001`, `1 shl 1` -> `0b0000_0000_0000_0010`, etc.
12:03:55FromGitter<ephja> yes but the integer value of {0, 1, 3} in binary is 1011
12:04:15FromGitter<ephja> but if you need to work with individual enumerators as well then you need a mapping
12:04:53FromGitter<ephja> in which case you might as well keep the original values. there are no shortcuts for this yet
12:05:10couven92@ephja: I don't understand
12:06:50couven92each value in my enum has different flags set, if I have a value for that enum I want to be able to: `evThree in value`, but for that I'd need a set... however a set does not seems to be reasonably castable to a numeric value
12:07:43couven92So my solution to this problem is to implement the enum as a distinct numeric type instead, and then implement the `in`, `incl`, etc. operators for that type instead
12:08:42couven92That of course, I'd do with a macro... I was just wondering if I'm just stupid with my usage of Nim set types, or if my approach actually is the best solution here
12:09:03FromGitter<ephja> operators like * are convenient, but that would work and it doesn't take long to implement
12:10:30FromGitter<ephja> this is what I've done in the past https://github.com/nim-lang/mongo/blob/master/lib/mongo.nim#L68
12:10:39couven92@ephja, yeah, I'm already doing that... So far I have automatic implementation of stringify, parse, tryParse and equals for enum types that are implemented as distinct numeric types
12:10:41FromGitter<ephja> https://github.com/nim-lang/mongo/blob/master/lib/mongo_binding.nim#L63
12:11:15FromGitter<ephja> this is yet another situation that a re-usable macro can be defined for
12:18:34ZevvIs it possible to hook into garbage collection, for example to free system resources (close fd's, etc) when an object gets collected?
12:19:48Yardanicoyes, destructors
12:20:33FromGitter<ephja> and https://nim-lang.org/docs/system.html#new,ref.T,proc(ref.T)
12:21:24couven92@ephja: actually works pretty well: https://github.com/couven92/nim-importc-helpers/blob/master/src/importc_helpers/importc_distinct.nim#L262 :)
12:22:12*dddddd joined #nim
12:22:42couven92I am now implementing that for flag values as well, implementing the set operations in addition to those I already do
12:25:35*dom96|w joined #nim
12:25:46FromGitter<ephja> neat
12:27:50FromGitter<ephja> couven92: considering using macros.getAst to make macros more readable. there's an example here https://nim-by-example.github.io/oop_macro/
12:27:57*haha_ joined #nim
12:29:15*haha_ quit (Client Quit)
12:29:27couven92@ephja, you mean with the proc implementations?
12:30:53FromGitter<ephja> a lot of things really. here's a more complex example https://gist.github.com/ephja/a97a0555853a57b5a0dcfa89bf5b0d6c
12:32:10couven92oh! cool, yeah, I'll do that with the new stuff I'm adding, thanks @ephja
12:36:47*haha_ joined #nim
12:55:13*haha_ quit (Quit: haha_)
12:59:26*rauss joined #nim
13:04:47*haha_ joined #nim
13:29:28FromGitter<ephja> Araq: regarding the compiler plugin that I'm writing: `let x = FOO` this gives me a node containing an nkIntLit node, so I'm not sure how to determine whether or not FOO belongs to a specific module. FOO is defined as a constant
13:39:37*arnaud2 joined #nim
13:41:22*relax joined #nim
13:45:06*xaxisx_ joined #nim
13:46:35*couven92 quit (Read error: Connection reset by peer)
13:47:43*xaxisx quit (Ping timeout: 248 seconds)
13:51:00*Jesin joined #nim
13:58:20*endragor quit (Remote host closed the connection)
13:58:28*PMunch quit (Quit: Leaving)
14:06:08*Matthias247 quit (Quit: Matthias247)
14:15:49*Matthias247 joined #nim
14:18:47*endragor joined #nim
14:23:24*endragor quit (Ping timeout: 252 seconds)
14:32:05*arnetheduck quit (Ping timeout: 240 seconds)
14:38:57FromGitter<ephja> it's probably irreversible
14:40:13FromGitter<ephja> the simplest fix would be to extend the node type
14:41:32*nattefrost quit (Remote host closed the connection)
14:41:51*MyMind joined #nim
14:42:39*Sembei quit (Ping timeout: 248 seconds)
14:46:29*haha_ quit (Quit: haha_)
14:48:40*Jesin quit (Quit: Leaving)
14:49:34*nsf quit (Quit: WeeChat 1.9)
14:49:55FromGitter<ephja> couven92: why not operate on enum type nodes? that way it's easy to extend bindings containing enums
14:53:20*Jesin joined #nim
14:55:49*endragor joined #nim
14:56:37FromGitter<ephja> "Like an enum type, but with an actual base type, so that the values can be used in ``importc`` calls" isn't the `size` pragma that you used relevant?
15:00:01*endragor quit (Ping timeout: 240 seconds)
15:03:01*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
15:06:47*Jesin quit (Quit: Leaving)
15:08:09*PMunch joined #nim
15:11:03*dom96|w joined #nim
15:12:22*Jesin joined #nim
15:19:36FromGitter<ephja> Araq: or why not transform the ident to a sym in this case as well
15:19:57*Trustable joined #nim
15:31:51*endragor joined #nim
15:35:50*mahmudov joined #nim
15:36:47*endragor quit (Ping timeout: 260 seconds)
16:03:57*haha_ joined #nim
16:05:29*nsf joined #nim
16:06:45YardanicoGUYS!!!
16:06:47Yardanicohttps://medium.com/@Codewars/latest-updates-new-languages-version-updates-smarter-markdown-and-translation-approval-additions-e1814ce5baab?medium=web&campaign=dashboard
16:06:50Yardanicothey finally added Nim!
16:06:54Yardanico(to codewars)
16:08:01Yardanicothere's not much katas now (only 15)
16:08:03Yardanicobut still
16:08:10*endragor joined #nim
16:08:18FromGitter<krux02> what is codewars?
16:09:02Yardanicohttps://www.codewars.com/
16:09:13Yardanicoyou solve code problems
16:09:15Yardanico:)
16:09:26Yardanicolike calculating some stuff etc
16:10:28Yardanicothey even added Brainfuck in the new update :D
16:11:50*gangstacat joined #nim
16:12:50*endragor quit (Ping timeout: 240 seconds)
16:13:43FromGitter<jilee210> is there a way to create set with strings such as
16:14:23FromGitter<jilee210> set1 = {"abc", "ABC"}
16:14:23Yardanicoyou wouldn't believe it
16:14:55Yardanicosomeone submitted a kata for the most simplest task: fix the code (so there is missing return type and + instead of *)
16:14:58Yardanicop_R_o_C m_U_l_T_i_P_l_Y*(a, b: i_N_t): i_N_t = a * b
16:15:01YardanicoI LOL'd
16:15:24Yardanicojilee210: AFAIK you can't use strings in set
16:15:36Yardanicobecause of performance
16:15:58Yardanicohttps://nim-lang.org/docs/manual.html#types-set-type
16:16:19Yardanicoonly int8,int16,uint8,byte,uint16,char,enum
16:18:02FromGitter<jilee210> thanks, in python, I can diff two files by creating two sets to see the difference regardless the order of line. I am trying to simulate it with nim. Guess I have to find another way
16:22:32FromGitter<Jipok> But 2 or more same lines lose their meaning in the set. This is not exactly the right way to diff
16:24:06FromGitter<ephja> https://nim-lang.org/docs/sets.html
16:24:57FromGitter<jilee210> we have two config files where duplicate lines will not matter. I would like to see any missing or extra config lines. Using set, I can ignore the order of lines appearing.
16:25:20Yardanicoephja: ah, sorry
16:25:24YardanicoI didn't knew :)
16:25:30Yardanicojilee210: use https://nim-lang.org/docs/sets.html
16:27:38FromGitter<jilee210> thanks a lot!
16:30:26*yglukhov quit (Remote host closed the connection)
16:34:06*gangstacat quit (Quit: Leaving)
16:36:38FromGitter<Jipok> (https://files.gitter.im/nim-lang/Nim/Uyft/___________.png)
16:36:44FromGitter<Jipok> Looks broken
16:37:18FromGitter<Jipok> Unable to retrieve package list: JSON.parse: expected double-quoted property name at line 5996 column 3 of the JSON data
16:37:37*endragor joined #nim
16:37:37FromGitter<Jipok> https://nim-lang.org/docs/lib.html
16:39:06Yardanicoyeah
16:39:12Yardanicousers reported tihs
16:39:26Yardanicobut maybe not on github?
16:40:57*endragor_ joined #nim
16:42:33*endragor quit (Ping timeout: 252 seconds)
16:43:30*gangstacat joined #nim
16:45:21*endragor_ quit (Ping timeout: 248 seconds)
17:03:42*mahmudov quit (Ping timeout: 260 seconds)
17:09:21*mahsav quit (Ping timeout: 248 seconds)
17:14:53*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
17:19:38*PMunch quit (Quit: leaving)
17:21:04*dom96|w joined #nim
17:22:25*mahmudov joined #nim
17:22:40*mahmudov quit (Client Quit)
17:22:57*mahmudov joined #nim
17:25:00*endragor joined #nim
17:30:04*endragor quit (Ping timeout: 276 seconds)
17:30:20FromGitter<indy9000_twitter> what's a good way to format a floating point number in echo ( strfmt doesn't seem to be available anymore)
17:30:39FromGitter<indy9000_twitter> I just want it to print only 4 decimal points
17:31:41FromGitter<ephja> strfmt?
17:32:21*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
17:33:27FromGitter<indy9000_twitter> strfmt was a module
17:33:55Yardanicoehm
17:33:57FromGitter<ephja> this https://bitbucket.org/lyro/strfmt ?
17:34:04Yardanicowhy you don't use stdlib?
17:34:16Yardanicoah, directly in "echo"
17:34:35Yardanicohttps://nim-lang.org/docs/strutils.html#formatFloat,float,FloatFormatMode,range[],Char
17:34:43Yardanicoit's only available as a proc thought
17:34:48Yardanicoand strfmt is available
17:35:48FromGitter<indy9000_twitter> ta!, import strfmt failed.. Is that a separate install?
17:36:46FromGitter<ephja> it's not part of the official distribution but it's available as a package
17:37:04*nsf quit (Read error: Connection reset by peer)
17:38:46FromGitter<indy9000_twitter> ah it needs hg!??!! :)
17:39:01FromGitter<ephja> oh. right
17:39:09FromGitter<indy9000_twitter> that's madness
17:40:06FromGitter<ephja> installing packages involves fetching repos
17:41:46FromGitter<ephja> at this point in time anyway. I wouldn't mind having non-repo methods
17:41:47*yglukhov joined #nim
17:41:50FromGitter<indy9000_twitter> yes, but don't think I want to install hg just for this package
17:41:51*haha_ quit (Quit: haha_)
17:42:32FromGitter<indy9000_twitter> could be good to have all contending packages be in git
17:42:34FromGitter<ephja> then you will have to get by with the more verbose strutils alternatives
17:43:02FromGitter<indy9000_twitter> looks like it :) thanks anyway
17:46:09*yglukhov quit (Ping timeout: 248 seconds)
17:57:52*Vladar quit (Quit: Leaving)
18:02:17*yglukhov joined #nim
18:03:35*Nobabs27 joined #nim
18:07:37*haha_ joined #nim
18:08:38*haha_ quit (Client Quit)
18:08:57*vlad1777d_ quit (Ping timeout: 240 seconds)
18:21:06*haha_ joined #nim
18:22:53ZevvI'm building a somewhat complex traffic generator based on asyncdispatch. I need to be able to generate data at an average fixed rate of n pkts/sec. Afaik there is no way to create a periodic timer with fixed interval on top of asyncdisatch, so my current solution is a closed loop system using sleepAsync(), measuring the speed and adjusting the delay value. All in all a bit cumbersome. Does anyone have any ideas for a creating fixed rate events?
18:25:25Zevvshort version: fast intervals built with asyncSleep() cause timer creep, how to solve this.
18:28:27dom96by timer creep do you mean that your timers are becoming delayed?
18:29:07Zevvyes, because each sleepAsync calculats the timer based on epochTime()
18:29:31ZevvI'm now reworking by adding a custom sleep that uses the internals of asyncdispatch to do a timers.push of a timestamp that is increased by my interval
18:29:44Zevvbut it's not so nice because it depends on the implementation of asyncdispatch
18:30:56Zevvthere is no concept of timers exposed in asyncdispatch, althogh this might be a useful addition
18:31:10Zevvperiodic timers, that is
18:31:48Yardanicoyeah I would also like them
18:31:58Yardanicopython asyncio has them :)
18:32:50dom96upcoming asyncdispatch might have something
18:32:56*haha_ quit (Quit: haha_)
18:33:31Zevvhm I see addTimer indeed
18:33:52Zevvhow do I import an upcoming lib?
18:34:02Zevvinstead of the pure version?
18:34:39dom96just specify -d:upcoming on the cmd line
18:34:43Zevvgreat
18:34:46*haha_ joined #nim
18:34:54Zevvand signals \o/
18:35:52dom96yeah, I need to merge this into current :)
18:35:59*haha_ quit (Client Quit)
18:36:07Zevvsweet
18:36:41dom96Note: its api may change a bit
18:38:23Zevvnp
18:39:18Yardanicodom96, wait there's ALREADY timers? lol
18:41:46*haha_ joined #nim
18:42:38*haha_ quit (Client Quit)
18:42:52Zevvbut accessing signals from asyncdispatch will allow unportable code
18:43:19Zevvthat's not as clear as using imports from posix
18:43:46*haha_ joined #nim
18:44:37*BitPuffin|osx quit (Ping timeout: 260 seconds)
18:45:28*joebo1 is now known as joebo
18:48:10Yardanicowhat would be the right way to overload comparasion operators?
18:48:22YardanicoI mean "=="
18:48:25Yardanicojust create a proc `==`?
18:48:28FromGitter<krux02> just overload ==
18:48:32FromGitter<krux02> yes
18:48:44FromGitter<krux02> and `<`
18:49:17FromGitter<krux02> != is defined to be `not ==`
18:49:27FromGitter<krux02> and the other operators similarly
18:49:53*endragor joined #nim
18:50:11Yardanicoalso, is it possible to do something like proc `+`[T](a, b: Point[T]): Point[T] = ?
18:50:30Yardanicowithout specifying T type manually
18:51:50FromGitter<krux02> https://github.com/nim-lang/Nim/blob/47a7f2fff795be3c4c28059cfa573f5d6069af44/lib/system.nim#L361
18:52:24FromGitter<krux02> what are the arguemnts to `+`?
18:52:39Zevvdom96: what is the rationale to use milliseconds as the minimum timer resolution instead of float seconds?
18:53:24dom96consistency with os.sleep
18:53:34FromGitter<krux02> well milliseconds is a pretty bad timer when performance should be measuered
18:53:39dom96as for the reason os.sleep uses it... ask Araq
18:54:43Zevvhm ok. I'm not able to get consistent rates > 1Khz at this time
18:55:00FromGitter<krux02> it is very inprecise compared to what the computer can
18:55:30ZevvUsing floats instead allows for any precision supported by the platform
18:55:54Zevvstruct timespec uses nanoseconds
18:56:16ZevvepochTime() does return a float, though
18:57:23Yardanicokrux02: type Point[T] = object x, y: T
18:58:32Yardanicokrux02: i'm just arguing with a guy who said that Rust has better generics than nim
18:59:45Yardanicohttps://doc.rust-lang.org/std/ops/trait.Add.html second example here
18:59:47dom96Yardanico: You can do precisely that
18:59:55dom96where are you arguing?
19:00:12FromGitter<krux02> can you point me to the discussion, I would disagree on that point
19:00:14Yardanicowell on russian social network so you can't join :)
19:00:35FromGitter<krux02> yea I don't have a VK account
19:00:44FromGitter<krux02> nor do I speak russion
19:01:29dom96oh pity
19:02:05Yardanicowell we have a *almost* friendly discussion, so no trolling
19:02:25FromGitter<krux02> well the rust generics have good type safety, but except from that, there is nothing the nim generices can't do
19:02:36FromGitter<krux02> and the nim inteface to it is simpler
19:02:50FromGitter<krux02> no I don't troll
19:02:56FromGitter<krux02> I tried rust myself
19:03:00Yardanicono I mean he's not trolling mean
19:03:02Yardanico*me
19:03:27Yardanicohttps://gist.github.com/Yardanico/bf0cdf371464173e2af9c9bd7bbb5d7a I've tried to replicate https://doc.rust-lang.org/std/ops/trait.Add.html second example here
19:03:33FromGitter<krux02> I know but these discussions are almost like "which religion is the true one"
19:05:06*endragor quit (Remote host closed the connection)
19:06:10FromGitter<krux02> I already see a few differences in Nim and Rust
19:06:24FromGitter<krux02> in Rust there is #[derive(Debug)]
19:06:32FromGitter<krux02> in nim there would be just a generic debug function
19:06:58Yardanicoit is (from rust docs): "Debug, to format a value using the {:?} formatter."
19:07:13Yardanicoso we don't need that in nim
19:07:44FromGitter<krux02> better said, nim could use it
19:08:06FromGitter<krux02> nim creates all those temporary strings, not a fan of that
19:08:11FromGitter<krux02> but that is not the point
19:08:41FromGitter<krux02> in Rust there is the trait Add, in nim tha trait is just not needed.
19:08:50FromGitter<krux02> maybe concepts, but even that is optional
19:09:14YardanicoPoint[int](x: 1, y: 0) + Point[int](x: 2, y: 3) == Point[int](x: 3, y: 3) so I need to use [int] here explicitly?
19:09:33Yardanicoah, I need a constructor
19:09:49*krux02 joined #nim
19:10:45Yardanicoso only like this? https://gist.github.com/Yardanico/bf0cdf371464173e2af9c9bd7bbb5d7a
19:12:20*oaao joined #nim
19:12:27*PMunch joined #nim
19:12:30krux02http://ix.io/zmO
19:12:31*endragor joined #nim
19:12:56FromGitter<krux02> I wouldn't use new
19:13:01Yardanicoyeah I know I can do that too
19:13:57Yardanicoso *at the moment* nim can't infer types of fields in an object constructor?
19:14:10krux02http://ix.io/zmP
19:14:55krux02I think so
19:15:07krux02and I doubt it is on the todo list
19:24:55*endragor quit (Remote host closed the connection)
19:31:01*PMunch quit (Quit: leaving)
19:33:17Yardanicokrux02, ah, his question was about other thing
19:33:27FromGitter<ephja> you also have tuples, and converters which you could only use as a convenience internally if you don't want to exposive them
19:33:29Yardanicosomething like this - https://stackoverflow.com/a/39118492/5476128
19:33:39Yardanico"type Output = Complex;"
19:33:46Yardanicoand "type Output = f64;"
19:38:24Yardanicowell I don't really need this stuff, I can't imagine why it's useful
19:44:03FromGitter<krux02> well I prefer the nim way to resolve this, simple overload resolution
19:45:38*mahsav joined #nim
19:48:16Yardanicodom96, is there any eta for community survey results? I don't rush you, just wanted to ask
19:49:05*krux02 quit (Remote host closed the connection)
19:50:21Yardanicoalso, slant - https://www.slant.co/topics/5984/~productivity-enhancing-well-designed-and-concise-rather-than-just-popular-or-time-tested-programming-la
19:50:34YardanicoI've added some topics to Nim and got many karma
19:50:47*endragor joined #nim
19:51:26dom96Yardanico: Nope
19:55:27*endragor quit (Ping timeout: 240 seconds)
19:55:47dom96Right now I feel like I should make it a priority to write a "Nim as a Better C" article inspired directly by that D article that's on HN/Reddit right now.
19:56:47Yardanicohmm, I'll read it now (but i almost never used dlang)
19:58:44*ipjk joined #nim
19:59:10Yardanicodom96, but would it be possible? it seems that D is much closer to C
19:59:23dom96what exactly?
19:59:32dom96Nim compiles to C and C++.
19:59:41dom96Just that fact makes it much better than D for this use case IMO
20:06:03Yardanicowell yeah, I just did first example from this article very easily
20:06:18Yardanicodifferent syntax, but result is the same
20:06:52Yardanicohmm, there's a second example
20:07:39FromGitter<Varriount> dom96: Congrats on your book (finally!) being released!
20:07:42Yardanicoand about this betterC: it seems that they have already defined functions like "printf" in D standart library
20:08:10dom96Yardanico: That's trivial to do.
20:08:13dom96Varriount: :D
20:08:15Yardanicoyeah I know :)
20:08:20dom96Varriount: thanks :)
20:10:46*endragor joined #nim
20:10:48*haha_ quit (Quit: haha_)
20:12:25*xaxisx joined #nim
20:12:29*endragor quit (Remote host closed the connection)
20:14:31Yardanicoeasy enough :) https://gist.github.com/Yardanico/bc45e9fda1b597e10ac6c87f7ec1c8d1
20:14:36Yardanico(direct translation)
20:14:45Yardanicoalso there's no equivalent of "flag[] = true" in Nim
20:15:24*xaxisx_ quit (Ping timeout: 252 seconds)
20:15:57Yardanicolol
20:16:08YardanicoI just implemented it in two lines
20:16:36YardanicoI was surprised that `[]=` works
20:16:56Yardanicoso I edited my gist for more "direct" translation
20:19:23Yardanicoim dumb
20:19:37Yardanicoor not
20:20:03Yardanico(I thought for a second that https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L274 is the same proc I need)
20:26:59dom96https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/dm157cs/
20:28:51YardanicoI hope they will not downvote you
20:28:58Yardanicopeople on reddit can sometimes be not very friendly
20:29:55FromGitter<ephja> D is so mediocre. why settle with something that's only slightly better than C or C++ when designing the language?
20:29:56*Yardanico quit (Remote host closed the connection)
20:30:29*rauss quit (Quit: WeeChat 1.9)
20:31:15TheManiacThat brings up something I've been meaning to ask as I don't think I've seen it in the manual. Is nim compiled with -d:release 'safe'?
20:31:45FromGitter<Yardanico> Not really
20:31:57FromGitter<Yardanico> Because it's a "release"
20:32:02TheManiac(I think I read that D doesnt' have undefined behaviour / ability to read beyond bounds etc)
20:32:10TheManiacI know you don't get stack traces etc
20:32:19FromGitter<Yardanico> But you can enable checks yourself if you want
20:32:27FromGitter<Yardanico> Even in release mode
20:32:52FromGitter<Yardanico> Also, about article : they say that executable size is identical
20:32:58TheManiacand it's interesting how python can be as fast or faster than nim until you deploy 'release' whereupon nim smokes all comers :)
20:33:32FromGitter<Yardanico> But I couldn't make hello world example be as small as c hello world
20:33:58federico3 speaking of which, I got some hello worlds down to 130 bytes on AVRs
20:34:26federico3...until I switched to stack GC (instead of none) and it got huge
20:34:27FromGitter<Yardanico> Well it's a standalone environment, but it's great anyway!
20:34:27FromGitter<ephja> release is just a series of switches. see the system config
20:35:04FromGitter<Yardanico> Well, but it's a GC on a (!)
20:35:06FromGitter<Yardanico> microcontroller
20:35:14FromGitter<Yardanico> I'm surprised that it works
20:35:42FromGitter<Yardanico> It means that you can use whole Nim stdlib (except os specific options)
20:35:47dom96TheManiac: The default is to have as much information to aid in debugging as possible
20:36:54*couven92 joined #nim
20:36:55dom96I think there is a -d:safe switch too
20:38:20*PMunch joined #nim
20:38:23*endragor joined #nim
20:38:34federico3if there is, it's not on the help
20:39:49FromGitter<ephja> "foo: bar" -> identDefs(sym, sym, empty), "foo: baz.bar" -> identdefs(sym, dotExpr(ident, ident)) shouldn't I get a symbol for the type in both cases after the semantic pass? that would make things much simpler
20:41:18dom96maybe I dreamt it :)
20:41:30dom96I don't really think release mode is unsafe though.
20:41:47TheManiacso release still has boundschecks etc?
20:41:54TheManiaceverything you can remove without becoming unsafe
20:41:56TheManiac?
20:42:28dom96https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L50
20:42:35*endragor quit (Ping timeout: 240 seconds)
20:43:24TheManiacok. so here be dragons!
20:44:08TheManiacthat said, given iterators etc there aren't so many times when you read into a buffer / index into an array, so I'm guessing the programing style makes it inherently safer
20:45:40dom96yeah, damn, here be dragons indeed.
20:45:57dom96Just tested it, get `0` when I access an out of bounds value of a seq
20:46:36*Trustable quit (Remote host closed the connection)
20:47:49TheManiacI've mostly had segfaults, but didn't know whether I could rely on it to segfault :)
20:48:33dom96Good to be aware of this, and perhaps enable the bounds checks
20:59:12ZevvIs there a way to get the name of a function N steps in to the call stack?
20:59:15FromGitter<Varriount> I think we've had one or two people say that certain checks (like overflow and bounds checks) should be on by default.
20:59:41FromGitter<Varriount> Zevv: If the binary is compiled in debug mode, you can look at the traceback structures
21:00:11Zevvthans
21:00:37Zevvk
21:01:56*sz0 joined #nim
21:10:16FromGitter<Yardanico> dom96: as I said, these people started to downvote you
21:10:33dom96oh well
21:11:04dom96lol https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/dm18aaj/
21:12:26FromGitter<Yardanico> And they started to upvote this "comment"
21:12:47FromGitter<Yardanico> It's Reddit, there's
21:13:31FromGitter<Yardanico> no way to know if people would upvote or downvote you
21:18:57*couven92 quit (Ping timeout: 248 seconds)
21:19:12*PMunch quit (Quit: leaving)
21:20:06dom96Yardanico: seems you created two replies
21:25:29*nsf joined #nim
21:25:53*relax quit (Ping timeout: 248 seconds)
21:26:16*endragor joined #nim
21:27:15FromGitter<Yardanico> Yes
21:28:36FromGitter<Yardanico> It was a mistake (some kind of glitch in mobile client)
21:29:19*endragor quit (Remote host closed the connection)
21:36:59*Nobabs27 quit (Quit: Leaving)
21:38:49*yglukhov quit (Remote host closed the connection)
21:45:53*ofelas quit (Quit: shutdown -h now)
21:49:20*Vindaar quit (Remote host closed the connection)
21:50:08*Vindaar joined #nim
21:57:00*cspar joined #nim
21:59:57*cspar__ quit (Ping timeout: 240 seconds)
22:04:06*Vindaar quit (Remote host closed the connection)
22:13:37FromGitter<Varriount> I upvoted the guy who commented on hating whitespace. :3
22:14:03FromGitter<Varriount> I might disagree, but that doesn't mean his comment doesn't have merit.
22:14:32ipjkiwonderifhewriteslikethis
22:15:11FromGitter<Varriount> ipjk: You're forgetting to omit all vowels
22:15:46FromGitter<Varriount> int iwndrfhwrtslkths
22:16:35*gokr quit (Ping timeout: 240 seconds)
22:16:37FromGitter<Varriount> dom96: Did you comment in the hacker news post too?
22:19:08*endragor joined #nim
22:20:06dom96Varriount: yep
22:21:51FromGitter<Varriount> dom96: Ah, it looks like the response there was more open
22:24:06*endragor quit (Ping timeout: 252 seconds)
22:27:13dom96damn, jxy is doing some serious scientific computing https://forum.nim-lang.org/t/3119
22:29:05FromGitter<zacharycarter> wow
22:29:26*endragor joined #nim
22:29:52dom96#mindblown
22:32:23federico3did jxy target a GPU? very nice
22:33:01dom96looks like jxy created a library for running code on CPU and GPU
22:33:11dom96at the same time :O
22:34:30federico3proc kern is doing that x += y * z on the GPU indeed
22:34:37FromGitter<ephja> interesting
22:40:23*endragor quit (Remote host closed the connection)
22:54:51*nsf quit (Quit: WeeChat 1.9)
23:09:38*NimBot joined #nim
23:11:19*couven92 joined #nim
23:12:15*gangstacat quit (Quit: Leaving)
23:15:38*endragor joined #nim
23:19:40*couven92 quit (Quit: Client Disconnecting)
23:20:27*endragor quit (Ping timeout: 240 seconds)
23:21:27*gangstacat joined #nim
23:24:21*Matthias247 quit (Read error: Connection reset by peer)
23:27:08FromGitter<dom96> https://twitter.com/d0m96/status/900498835587334144
23:30:37*arnetheduck joined #nim