<< 02-09-2017 >>

00:15:04*loc8_ joined #nim
00:18:01*loc8 quit (Ping timeout: 240 seconds)
00:20:45TheManiacAwesome thanks, but why?
00:23:05*endragor joined #nim
00:27:43*endragor quit (Ping timeout: 248 seconds)
00:37:34*Araq quit (Ping timeout: 264 seconds)
00:38:01*Amrykid quit (Ping timeout: 240 seconds)
00:38:31*Amrykid joined #nim
00:38:31*Araq joined #nim
00:38:56*dom96 quit (Excess Flood)
00:40:32*dom96 joined #nim
00:49:18*Matthias247 quit (Read error: Connection reset by peer)
01:02:10*chemist69 quit (Ping timeout: 246 seconds)
01:16:43*chemist69 joined #nim
01:31:47FromGitter<cheetelwin> Hey @ephja, I've been building something on top of your glfw wrapper and I ran into an issue. Any reason compiling with '--threads:on' would cause a compiler crash? I've narrowed it down to somewhere in here https://github.com/ephja/nim-glfw/blob/master/src/glfw/wrapper.nim. Here's the output from koch c temp https://hastebin.com/inimeyatuc.lua ⏎ ⏎ I
01:43:50*loc8 joined #nim
01:46:05*loc8_ quit (Ping timeout: 240 seconds)
01:54:12*Nobabs27 quit (Quit: Leaving)
02:01:34*ipjk_ joined #nim
02:04:49*ipjk quit (Ping timeout: 248 seconds)
02:37:35*mahsav joined #nim
02:38:24*mahmudov joined #nim
02:44:51*francisl joined #nim
02:44:58*mahmudov quit (Quit: Leaving)
02:45:14*mahmudov joined #nim
03:33:29*mwbrown quit (Quit: Exiting)
03:36:54*mwbrown joined #nim
03:41:41*mwbrown quit (Client Quit)
03:43:27*dddddd quit (Remote host closed the connection)
03:46:20*mwbrown joined #nim
03:46:50*francisl quit (Quit: francisl)
03:47:35*Ven`` joined #nim
04:01:10*mwbrown quit (Ping timeout: 240 seconds)
04:02:08*mwbrown joined #nim
04:29:07FromGitter<Sud0nim> I'm having a first go at making a wrapper for a C++ dll/header file - it's several thousand lines of code, so I won't try and post the full wrapper file, but essentially the problem I am running in to is that for the Procs I get an error such as "could not import: QueryInterface" for all of the procs in the DLL. I was hoping somebody here might have encountered a similar issue before, and if so how they fixed it? ```
04:29:07FromGitter... ⏎ type ⏎ CManagerInterface* = object ## --- dummy methods for delphi ⏎ ⏎ proc queryInterface*(this: var CManagerInterface, riid: REFIID, obj: ptr LPVOID): cint {.cdecl, importcpp: "QueryInterface", ... [https://gitter.im/nim-lang/Nim?at=59aa3393210ac26920e82887]
04:29:16FromGitter<Sud0nim> Hmm, sorry markdown didn't work
04:30:41FromGitter<Sud0nim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59aa33f1ee5c9a4c5f25114c]
04:30:58FromGitter<Sud0nim> That is the wrapped proc, meanwhile this is the header file definition:
04:31:14FromGitter<Sud0nim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59aa3412ee5c9a4c5f251189]
04:35:06FromGitter<Sud0nim> I did have to do some of the nim wrapper code manually, as c2nim didn't like the LPVOID* obj - and I also needed to define LPVOID and REFIID based on a winapi.nim file: https://github.com/jangko/nppnim/blob/master/winapi.nim
04:38:08*pilne quit (Ping timeout: 240 seconds)
04:39:00*pilne joined #nim
04:46:59FromGitter<Sud0nim> I should also mention: using the same dll and creating a C++ console application, there are no issues calling the methods/functions/procs from the dll - the methods definitely do exist
04:48:48*francisl joined #nim
04:57:01*Ven`` quit (Ping timeout: 240 seconds)
05:34:16*francisl quit (Quit: francisl)
06:17:01*mwbrown quit (Ping timeout: 240 seconds)
06:18:43*mwbrown joined #nim
06:44:10*mahmudov quit (Read error: Connection reset by peer)
07:03:26*haha_ joined #nim
07:23:54*Trustable joined #nim
07:24:10*haha_ quit (Quit: haha_)
07:48:45*claudiuinberlin joined #nim
07:48:52FromGitter<stisa> TheManiac it's probably because your Quantifier enum doesn't have a valid default value as you don't have a value for zero, see https://forum.nim-lang.org/t/3026
07:55:00*pilne quit (Remote host closed the connection)
07:55:46*Arrrr joined #nim
07:58:32*BigEpsilon joined #nim
08:17:49FromGitter<ephja> @cheetelwin I have no idea. I'm going to apply a patch today that touches every other line in the library so maybe it'll just happen to work then. examples will be fixed and most issues will be closed btw
08:21:42*haha_ joined #nim
08:39:36*ipjk_ quit (Read error: Connection reset by peer)
08:39:53*ipjk_ joined #nim
08:41:06*Matthias247 joined #nim
08:43:17*Matthias247 quit (Read error: Connection reset by peer)
08:44:41*Matthias247 joined #nim
08:46:06*haha_ quit (Quit: haha_)
08:47:08*haha_ joined #nim
09:02:23*Snircle joined #nim
09:06:01*haha_ quit (Quit: haha_)
09:08:16*nsf joined #nim
09:12:55*miran joined #nim
09:19:17*couven92 joined #nim
09:19:30*Yardanico joined #nim
09:21:01Yardanicohi
09:21:35*gangstacat joined #nim
09:21:36couven92Yardanico, hi! :) You stalking me? (you logged in about 5 seconds after me :P )
09:22:00Yardanicocouven92, no, just came from the school :)
09:22:13couven92on a saturday?
09:22:17Yardanicoyeah
09:22:32YardanicoI live in Russia
09:22:50couven92they have school on sayurday?
09:22:58Yardanicoyes
09:23:18couven92Hmm... I didn't know...
09:23:33couven92Wow, now even I learned something this weekend! :O
09:23:49Yardanicowe have school at all days except sunday
09:24:41couven92Hmmm... I went to school with a guy that grew in Moscow... he never told me that...
09:24:48couven92*grew up
09:25:35*Ven joined #nim
09:26:00*Ven is now known as Guest66504
09:26:21Yardanicowell most of our schools are public schools (funded by the government), we have 11 grades
09:26:31Yardanicowell 10 and 11 are optional
09:26:37Yardanicoyou can go to college instead
09:27:23Yardanicoalso "college" and "university" in russia are very different things
09:27:36*BigEpsilon quit (Ping timeout: 252 seconds)
09:28:15*adamchainz left #nim ("Textual IRC Client: www.textualapp.com")
09:28:19couven92ah... yeah, here in Norway, we have 10 mandatory years and then 3 more for university entry qualification
09:28:57couven92Used to have that in Germany, too when I went to school, but they changed it from 13 to 12 years now.
09:31:14ArrrrSchool in saturday? Are people in Russia more intelligent?
09:36:18*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
09:44:07YardanicoArrrr, well I can't answer questions like that, but a lot of intelligent russian people emigrate to other countries
09:44:16Yardanicofor example programmers
09:44:46Yardanicobecause salaries are not very high
09:45:05Yardanicoso we have "brain drain" in russia
09:45:38Yardanicobut I don't really think that studying 6vs5 days has that much difference
09:46:04Yardanicobtw, you can read there - https://en.wikipedia.org/wiki/Education_in_Russia
09:47:14ArrrrThanks
09:47:15miranhi guys, it's me and my beginner questions again :)
09:47:39miranvar columns: array[8, string]
09:47:46miranfor i, _ in columns:
09:47:47miran columns[i] = ""
09:48:17miranany more intelligent way to do this? (i want to have empty strings so i can add characters to it later)
09:48:23Yardanicomiran, yeah
09:49:01Yardanicomiran, https://nim-lang.org/docs/algorithm.html
09:49:05Yardanicoproc fill[T](a: var openArray[T]; value: T)
09:49:17Yardanicobut you'll an additional import for this :)
09:49:43mirani'll aready have algorithm import because i use `sorted`
09:50:08ArrrrAnother way: for str in mitems(columns): str = ""
09:50:35Yardanicoyeah, mitems allows you to modify value for current iteration
09:51:23miranthanks Arrrr!
09:52:02Yardanicoalso eventually seq and string will have default values
09:52:14Yardanicoso you wouldn't need to initialise them
09:52:23mirani guess this could do it too:
09:52:28miranvar columns = ["", "", "", "", "", "", "", ""] :)
09:52:31Yardanicoyeah
09:52:36Yardanicobut this is less elegant :)
09:52:45miraneasy when there are 8 items, and not 800 ;)
09:53:16miran"also eventually seq and string will have default values" -> this would be great! (from my very limited experience with nim)
09:53:44Yardanicowell it would be just an exception
09:53:50Yardanicobecause seqs and strings are widely used
09:54:02Yardanicoso less SIGSEGVs
09:55:09mirani see SIGSEGV couple of times each day :)
09:55:36mirani thought that's because of me and my python background :)
09:55:40Yardanicowell they come from uninitialised values
09:55:47Yardanicopython doesn't have a thing like that (only None)
09:55:48Yardanicobtw
09:55:55Yardanicoyou can turn "sigsegv" into "nil access error"
09:56:20Yardanicojust import module "segfaults"
09:56:51mirani know, that's why i keep forgetting to initialize, but it will get better with more nim experience (or when nim gets the default values)
09:57:17Yardanicomiran, well "segfaults" module is needed if you want to catch SIGSEGV as a proper exception
09:57:25Yardanicobut I doubt it will work 100% of time
09:57:48YardanicoI mean in most of cases it would throw a proper error that you can catch
09:58:01Yardanicomiran, nim has default values only for value types currently
09:58:10Yardanicobasically everything that is not "ref" or "ptr"
09:58:11mirancurrently my proc's are filled with `result = @[]` or `result = ""`
09:59:39Arrrrmost programming languages requires initialization of pointers.
10:00:18miranand for a language that is otherwise quite elegant, this slightly decreases the elegance
10:00:20YardanicoArrrr, well, a lot of newbies coming from Python (btw I came from python too) don't understand this at the beginning
10:00:35Yardanicobecause they've never worked with languages like C/C++ (neither did I)
10:00:40ArrrrAh, that explains the thing
10:01:02miranyep, python 'spoiled' me in that way
10:01:33miranand i really like nim because it takes some of that python-elegance and ease-to-use
10:01:36ArrrrWell, it depends on why do you need nim. I need it for the performance, so i accept controlling when to allocate memory.
10:02:06Yardanicomost of python syntax is valid in Nim (I'm about AST)
10:02:35Yardanicoproof: https://github.com/Yardanico/nimpylib/blob/master/examples/example2.nim
10:03:01*Guest66504 quit (Ping timeout: 240 seconds)
10:03:18miranYardanico: yep, it took some time to realize that's not python code :D :D
10:03:32Yardanicomiran, but please don't use it in real nim code, it's just an experiment :)
10:03:53miran:)
10:04:02YardanicoI want to implement this eventually https://github.com/Yardanico/nimpylib/issues/3
10:05:16*Ven joined #nim
10:05:40*Ven is now known as Guest63547
10:21:25*Guest63547 is now known as Ven``
10:26:18*vlad1777d joined #nim
10:27:44*ShalokShalom_ joined #nim
10:29:19*ShalokShalom quit (Ping timeout: 248 seconds)
10:32:17FromGitter<ephja> this isn't possible, is it? ⏎ ⏎ ```template t(args: untyped) = ⏎ type T = proc(args)``` [https://gitter.im/nim-lang/Nim?at=59aa88b19acddb2407f53450]
10:33:34Yardanicohmm, probably not with a template
10:33:45Yardanicobut with a macro :)
10:33:55Yardanicobut I may be wrong
10:34:08Yardanicoephja: how you want to call this template?
10:34:13Yardanicot(x: int, y: bool)
10:34:14Yardanicolike this?
10:34:57Yardanicothis wouldn't work AFAIK
10:35:27YardanicoIt's not a correct syntax
10:41:00FromGitter<ephja> it would have to be t((args...)) then
10:41:23Yardanicoyeah
10:41:34Yardanicobut still you can't do that with a template
10:42:05*Matthias247 quit (Read error: Connection reset by peer)
10:43:24*Matthias247 joined #nim
10:48:44*Matthias247 quit (Read error: Connection reset by peer)
10:49:03*Arrrr quit (Ping timeout: 248 seconds)
11:02:01*BigEpsilon joined #nim
11:05:25*Trustable quit (Remote host closed the connection)
11:15:11*Sentreen joined #nim
11:16:48FromGitter<ephja> no you can't atm, and perhaps you would have to do "proc args" instead if it had worked
11:19:11dom96wow, school on a saturday, that's really weird.
11:19:18dom96Do Russians work on saturdays as well?
11:19:35dom96Do you stay in school less at least?
11:19:44dom96like, do you leave earlier each day?
11:22:53*Arrrr joined #nim
11:22:53*Arrrr quit (Changing host)
11:22:53*Arrrr joined #nim
11:25:36*vendethiel- joined #nim
11:27:10dom96Hrm, maybe we should create a template for people to submit their bugs that allows us to easily test the code they've submitted to see if it's still a bug.
11:27:42dom96Anyone want to create this as a project? :)
11:27:48dom96Yardanico: Perhaps you?
11:29:31Yardanicodom96, about schools - 8-11 classes (or maybe it's better to use "grades", I don't really know) have 5-6 lessons a day (each lesson is 45 minutes except 40 minutes in sunday), 5-15 minutes breaks. as an exception 8-9 classes have 4-5 lessons in sunday
11:30:04dom96Yardanico: "Years 8 - 11" is I think how the English refer to them :)
11:30:12dom96or maybe even "School Years"
11:30:16dom96since it's not the person's age
11:30:21Yardanicoah, ok
11:30:58dom96wait, sunday?
11:31:06Yardanicoah
11:31:07Yardanicosorry :D
11:31:11Yardanicononono
11:31:17dom96You mean saturday i guess?
11:31:20Yardanicoyeah :)
11:31:45Yardanicoso basically from 08:00 to 13:30 (for 6 lessons) including breaks
11:31:59dom96Okay, so you do get to go home early.
11:32:23dom96For us it's 09:00 to 15:45 IIRC
11:32:46dom96Funny how quickly I forgot the schedule :)
11:33:17Yardanicodom96, well in 9 and 11 school years we have additional lessons (preparation for state exams)
11:33:42Yardanicoso it may actually be something like 08:00 to 14:20
11:34:21*vendethiel- quit (Ping timeout: 240 seconds)
11:34:33dom96That's interesting.
11:34:46Yardanicowell it depends on the school and teachers
11:35:07dom96sure
11:35:15Yardanicobut private schools are not a common thing in russia
11:35:25dom96But would you say the majority of Russian schools have classes on Saturdays?
11:35:36Yardanicodom96, yes, sure
11:36:18FromGitter<ephja> people will go along with anything for free vodka
11:36:28Yardanico:D
11:36:49Yardanicosadly they don't offer vodka at schools lol
11:37:16FromGitter<ephja> I see
11:37:18Yardanico(well not really sadly for me)
11:37:37dom96I wonder if there is any people out there that attended many different schools all around the world.
11:37:46dom96If there is and they wrote a book I would read it.
11:38:12dom96In fact, you could probably write it by just getting a bunch of people from different countries
11:38:26*vendethiel- joined #nim
11:38:34dom96But anyway, back on topic :)
11:38:50dom96Yardanico: Interested in writing a bot to verify that issues on the Nim repo are still valid?
11:38:58Yardanicodom96, yeah I would try to do it
11:39:21dom96Awesome.
11:39:23YardanicoIt should be easy as long as nim code is written in proper markdown
11:39:28FromGitter<ephja> nim-glfw has a few examples that depend on other packages. perhaps it would be best to have them in a separate package. the binaries just need to have more unique names
11:39:33dom96Yeah, I think you can make some assumptions
11:39:45dom96Like force people to specify where the code is and where the expected output is
11:39:55dom96We can enforce this for issues going forward
11:40:24dom96And your bot can automatically check for this and berate people if they get it wrong as well :)
11:40:37dom96Of course there will be a way to override this if an issue is too complex
11:40:43FromGitter<ephja> running with a debug build of the compiler makes it much easier to find duplicates
11:42:00Yardanicoalso one thing I find interesting about github is "every pull request is an issue, but not every issue is a pull request."
11:42:15dom96yeah, that's a bit weird
11:42:35dom96After using Phabricator I've come to realise that GitHub is actually missing some nice features
11:43:26*haha_ joined #nim
11:47:51*haha_ quit (Ping timeout: 252 seconds)
11:47:51*vendethiel- quit (Ping timeout: 252 seconds)
11:51:49dom96Going through issues is so addictive, it's like a game :)
11:52:28Yardanicoyeah
11:56:07*haha_ joined #nim
11:59:04*themagician joined #nim
12:06:57*haha_ quit (Quit: haha_)
12:07:55*haha_ joined #nim
12:09:11*haha_ quit (Client Quit)
12:10:35Yardanicodom96, well github api itself is very simple (for simple cases)
12:10:39Yardanicohttps://gist.github.com/Yardanico/d2cdecaa4e2b4fdcef36edd43ccf4bca
12:10:50Yardanicowell I'm not getting all issues here
12:10:56Yardanicoi want getIssues to return seq of issues
12:12:47*Arrrr quit (Ping timeout: 248 seconds)
12:13:04dom96I think GitHub let's you subscribe to a sort of "issue stream"
12:13:10dom96where you are able to get new issues
12:13:15Yardanicowell I know
12:13:16Yardanicowebhooks
12:13:28Yardanicohttps://developer.github.com/v3/activity/events/types/#issuesevent
12:13:29dom96But I guess you want to look at older issues too
12:13:34dom96I think that will be trickier
12:14:15Yardanicothanks god GitHub has the same JSON format for issues from webhooks and issues from usual api
12:25:12*loc8_ joined #nim
12:28:05*loc8 quit (Ping timeout: 240 seconds)
12:28:50Yardanicodom96, better version of this stuff :) https://gist.github.com/Yardanico/f61a4f35df6488c1cff0d64268e860e3
12:29:02YardanicoI've used strscans for parsing next page from "Link" header :P
12:29:31Yardanico(because I don't want a chain of ugly splits and it's actually needed for control flow)
12:29:45dom96awesome! You're a scanf expert now
12:29:48dom96I've never actually used it heh
12:29:57Yardanicowell they're useful sometimes
12:30:08Yardanicobecause they're faster than splits and because of "if" :)
12:30:25Yardanicothey're not like regexps
12:31:12Yardanico<$+>; rel=\"next" means that url will be a someUrl if string is <someUrl>; rel="next"
12:31:50FromGitter<krypton97> is there a graphql implementation in nim?
12:32:00Yardanicono :(
12:32:16FromGitter<krypton97> well, that's not nice
12:32:28FromGitter<krypton97> but porting the js library shoudn't be hard
12:33:43dom96krypton97: Do it :D
12:34:02YardanicoWell it would be better to create "nim-style" graphql implementation
12:34:10Yardanicobecause of metaprogramming :)
12:34:14FromGitter<krypton97> yep
12:36:04dom96yeah, you'll be able to parse the graphql at compile-time which will be awesome
12:40:52*orange33 joined #nim
12:40:58couven92shr 2 is flooring division by 2, right?
12:41:17orange33Anyone know how I can convert seq[byte] to a string?
12:41:20couven92sry, shr 1, ie mean
12:41:27Yardanicoorange33, yeah
12:41:34Yardanicoone sec
12:43:56Yardanicoorange33, well you can do it different ways
12:44:24orange33Ok
12:44:28Yardanicoone sec
12:45:12mirancouven92: shr 1 == div 2
12:45:28couven92which is flooring?
12:45:38miranit is
12:45:39Yardanicoorange33, if you want unsafe+fast approach - let yourString = cast[string](yourByteSeq)
12:45:59couven92miran, thanks! I am never really sure of these things... :P
12:45:59Yardanicobut i'm not sure how it works :D
12:46:05Yardanicocan this leak memory?
12:46:37mirancouven92: the best thing is to try it yourself with couple of examples.
12:46:49dom96Yeah, don't do what Yardanico suggested
12:46:59couven92miran, yeah, but I'll forget about in 5 minutes :P
12:47:12Yardanicodom96, well it's unsafe and fast (maybe he wants the fastest approach)
12:47:39mirancouven92: well, `div` and `mod` shoud be easy to remember because those are "universal words"
12:47:56couven92miran, it's more the flooring
12:48:00dom96orange33: You can use foldl (or foldr?) for this
12:48:02Yardanicosafe approach:
12:48:08Yardanicovar yourStr = ""
12:48:08orange33Yardanico: thanks!
12:48:17Yardanicoorange33, wait a sec
12:48:18orange33dom96: thanks !
12:48:23Yardanicovar yourStr = ""
12:48:34Yardanicofor x in youByteSeq: yourStr.add chr(x)
12:48:35dom96foldl(bytes, a & b, "")
12:48:36mirancouven92: `shr` i forget if it is shr or rsh :) (unfortunately, you can't do plain and simple >>)
12:48:40Yardanicodom96, well yeah
12:48:45dom96it's in the sequtils module
12:48:53Yardanicodom96, but it needs to import "sequtils" :)
12:48:54*dddddd joined #nim
12:48:57dom96so?
12:49:03orange33Ok cool I will have a look at that :)
12:49:20dom96You don't get a penalty for importing modules
12:49:23Yardanicoyeah I know
12:49:36dom96ok, you were implying as if it was a bad thing :)
12:49:51Yardanicoalso, I'll ask Araq if cast[string](someSeqOfBytes) is unsafe (e.g. if it can leak memory), just curious
12:49:58miranbtw, dom96 and Yardanico, is there any advantage of using `from module import function`? (other than readability)
12:50:17Yardanicomiran, well you wouldn't able to use other functions from this module :P
12:50:24Yardanicolet me check
12:50:33orange33Thanks for the help Yardanico and dom96! :)
12:50:44couven92miran, Nim is not Java! :P
12:51:07dom96miran: just readability
12:51:15Yardanicowell I just checked - only readability
12:51:20YardanicoC code would be the same
12:51:26Yardanicosince Nim codegen knows how to remove dead code
12:51:30Yardanico(and C compiler knows it too)
12:51:40dom96Yardanico: You would need to do: cast[string](bytes[0]) btw
12:51:43dom96The [0] is important
12:51:50couven92But sure, I'd use the `from m import p` only if need to avoid name collisions, right?
12:51:51Yardanicodom96, ah, to get an address?
12:51:53mirancouven92: it is not java, it is python which compiles to C :D
12:52:01Yardanicocouven92, yes
12:52:21*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:52:23Yardanicowell you solve collisions by specifying full proc name including module
12:52:28Yardanicoe.g. someModule.someProc()
12:52:30dom96Yardanico: Sort of, it's because a seq is a struct { int len, array[...] items }
12:52:46Yardanicoah, ok
12:52:49dom96You want to grab the first items, otherwise you get the 'len'
12:53:08Yardanicowell I don't know how , but it worked :D
12:53:29dom96You probably got "lucky"
12:53:38dom96this is why 'cast' is dangerous
12:53:54Yardanicodom96, well yeah
12:54:16Yardanicodom96, echo cast[string](@[byte(33), byte(35)]) doesn't work, but if you declare sequence as another variable - it works
12:54:35*xet7 quit (Ping timeout: 240 seconds)
12:56:24dom96of course, because it's a literal
12:56:30Yardanicoah, yes
12:57:52Yardanicothere's 3 ways to do something in nim: straightforward one, elegant one (but sometimes slower than others), and fastest (and unsafest) one :P
13:09:43*xet7 joined #nim
13:10:04FromGitter<Grabli66> Hi. Is there a pragma do not compile if there are unused variables? I found none in documentation.
13:14:07Yardanicowhy you want this?
13:14:26dom96Not that I know of, might be a good feature request.
13:15:01FromGitter<Grabli66> I want my code free from unused variables
13:15:17dom96there might be an option that you can give the compiler though
13:15:23Yardanicowell just see hints that compiler gives you ? :)
13:15:59Yardanicoand if you use something like vscode it would underline them with green
13:16:09Yardanico(underline unused variables)
13:16:15Yardanicobecause it uses nim check
13:16:35FromGitter<Grabli66> I can not notice.
13:17:59FromGitter<Grabli66> But if my code will not compile. I'll notice that.
13:19:17couven92Grabli66: file an issue https://github.com/nim-lang/Nim/issues/new
13:19:23couven92It's a good idea
13:19:49FromGitter<Grabli66> Ok
13:26:54YardanicoGrabli66: but what's bad if something is not used from your code?
13:27:05YardanicoI can't really understand an usecase of this
13:28:35dom96It's about keeping your code clean
13:28:49dom96Code that is tidy is easier to read
13:28:50FromGitter<Grabli66> The aim is to clean code from garbage.
13:29:00dom96Which means you spend less time reading code that's not even used
13:32:01*ShalokShalom_ is now known as ShalokShalom
13:37:09*orange33 quit (Ping timeout: 260 seconds)
13:42:52couven92Is Araq here?
13:44:18Yardanicohe's always *here* :)
13:44:21YardanicoI mean in IRC
13:44:44couven92yeah... I need help with editDistance :P
13:45:15Yardanicocouven92, let me guess. you've replaced everything but it still shows incorrect results?
13:45:51couven92Yardanico, see for yourself: https://github.com/couven92/Nim/commit/c8a36647af899f54afa6274e4c47fd9c417d9cb3
13:47:01couven92calculating these upper triangles and lower triangles (whatever they are) is really hard when you have to take varying rune length into account...
13:47:26couven92and now I have messed up somewhere these and get an infinte loop
13:50:16couven92And I have still not figured out how the algorithm works yet... that makes it hard... contrary to what Araq says, you can't just exchange chars with runes here, that simply doesn't work as he suggested
13:51:21*Arrrr joined #nim
13:51:21*Arrrr quit (Changing host)
13:51:21*Arrrr joined #nim
13:59:39FromGitter<sysint64> Hello! where can I suggest feature for nim? I did not found operator `with ` to which I am so used in Delphi before and in D now.
13:59:54dom96hello sysint64!
14:00:02dom96https://github.com/nim-lang/nim/
14:00:10dom96Create an issue there
14:00:23dom96Although it might be good to discuss it here first
14:00:37dom96What does this 'with' do?
14:01:52FromGitter<sysint64> I put examples in D since I just began using nim. there is example without operator with
14:02:13FromGitter<sysint64> obj.a = 10; ⏎ obj.b = 12; ⏎ obj.c = "Hello";
14:02:47FromGitter<sysint64> with operator `with`: ⏎ with (obj) { ⏎ ⏎ ```a = 10 ⏎ b = 12 ⏎ c = "Hello"``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=59aaba07bc46472974ebac1f]
14:02:56FromGitter<sysint64> sometimes it's very usefull
14:03:27mirani can't tell from the example, is it a context manager, like `with` in python?
14:05:05Yardanicowell you can probably do this with a macro :)
14:06:04FromGitter<sysint64> @miran no it's just reduce code repetition in this particular case - it constant repetition of `obj`
14:06:10federico3or just a template
14:06:13dom96oh, this already exists in Nim
14:06:23Yardanicooh bad
14:06:27Yardanicoit's a reserved keyword
14:06:34Yardanicobut not actually implemented :)
14:07:03YardanicoI can make a mcro with name "toWith"
14:07:11dom96Firstly, there is this related thing: https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement
14:07:36Yardanicowell it's not the exact same thing
14:07:47Yardanicothere's also {.this: self.} but it's specific to procedures
14:08:54Yardanicofederico3, hmm, I can't really implement this with a template :)
14:08:56dom96Yeah, {.this.} is what I was thinking of
14:09:34Yardanicohmm let me try it without any procs
14:09:36Yardanicomaybe it works
14:09:47dom96Some examples here https://forum.nim-lang.org/t/2454
14:09:53*mahmudov joined #nim
14:10:20Yardanicoyeah it works
14:12:03Yardanicobut not always though
14:12:55Yardanicohttps://gist.github.com/Yardanico/36a21ae9abd235ef75b73a890f1b5029
14:13:11YardanicoI've put it into a block to actually mimic "with" scope
14:13:19Yardanicoyou can use {.this.} pragma without blocks
14:14:29Yardanicobut if you want it inside procedures whose are working with your object, you can use {.this: self.} and call your object as "self" in proc arguments
14:14:39Yardanico*name your object
14:14:59FromGitter<sysint64> Can I write nested .this e.g. {.this: myobj.somestruct.filestruct.}?? e.g. in D I can write something like this: ⏎ struct A { ⏎ MyOtherStruct myStruct; ⏎ } ⏎ struct MyOtherStruct { ... [https://gitter.im/nim-lang/Nim?at=59aabce3ba0f0f6e380ccfb0]
14:15:16FromGitter<Yardanico> let me try :)
14:16:31Yardanicooh wait
14:16:37Yardanicoit seems this doesn't work hmm
14:16:47YardanicoI mean "{.this: self.}"
14:17:06YardanicoI'll write a macro instead :P
14:17:20Yardanicodon't leave yet
14:18:30FromGitter<sysint64> ok :)
14:22:07FromGitter<sysint64> nim looks very interesting, when I was a child I was writing on Delphi a lot and nim reminded me good old times
14:23:18FromGitter<sysint64> and at the same time there is everything that I like so much about D
14:24:08*pilne joined #nim
14:25:37dom96That's great to hear :D
14:25:54FromGitter<sysint64> and now I can't make a choice: D or NIM, both steep
14:27:10dom96We're going to be pretty biased here and suggest Nim :)
14:27:30dom96But out of curiosity, what software are you planning to write?
14:27:37dom96that might help with the decision
14:29:27dom96Yay https://github.com/nim-lang/Nim/commit/90fa64501f0eba487182a760fde98f7bb955c3d7 :)
14:29:38Yardanicodom96, what's this?
14:29:57dom96Support for this feature https://github.com/nim-lang/nimble#nimble-develop
14:29:57FromGitter<sysint64> yes nim very neat, and more neat than D in my opinion :) ⏎ I am planning write various simulations and maybe games in somewhen )
14:30:51Yardanicoyou'll understand the power of metaprogramming when I will make a simple "toWith" macro (without additional checks, but working) :)
14:31:35dom96Nim is perfect for games :)
14:34:53Yardanicoyeah I did it
14:35:48FromGitter<sysint64> another feature that I like in D is UDA (user defined attributes) - https://dlang.org/spec/attribute.html#uda
14:36:03Yardanicoyeah you can do that
14:36:06Yardanicoin nim it would be a pragma
14:37:44FromGitter<sysint64> with this I'm writing simple UI framework in D there is example of usage: ⏎ https://gist.github.com/sysint64/135c5c60e47ebd4f77bd88a15bdbbac1
14:38:16Yardanicoin python they're called "decorators" btw
14:38:20Yardanicosame in java iirc
14:38:36FromGitter<sysint64> decorators it's not the same as attributes
14:39:44FromGitter<sysint64> in attribute I can attach different data to functions or variables and after using this data for code generation or proccess them in runtime
14:40:08Yardanicowell yeah, probably nim pragmas allows you do the same
14:41:56dom96yep, you can have {.ViewWidget: "cancelButton".}
14:41:57dom96in Nim
14:42:32FromGitter<sysint64> that's great )
14:50:32dom96Nim in Action is 50% off today as well https://twitter.com/d0m96/status/903993461711523840 :)
14:50:44dom96You can get the pBook half off today as well
14:56:59FromGitter<sysint64> Nim in Action - is a good book?
14:58:02dom96From what i've heard it is :)
15:00:20miran:D
15:04:12FromGitter<sysint64> how difficult is it to write DSL on nim? are there any examples?
15:06:48*Matthias247 joined #nim
15:07:39dom96Here is an example from the book https://github.com/dom96/nim-in-action-code/blob/master/Chapter9/configurator/configurator.nim
15:07:51dom96I'd say the difficulty is average
15:08:56Yardanicodom96, btw, you could've used templates or quote do
15:09:36dom96hrm? i did
15:15:12*BigEpsilon quit (Ping timeout: 252 seconds)
15:32:52FromGitter<Yardanico> @sysint64 sorry for the delay
15:32:54FromGitter<Yardanico> here you go - https://gist.github.com/Yardanico/0318e54afe7527ab1e74b101c24bd78e
15:33:01Yardanicothis is "toWith" macro
15:34:04FromGitter<Yardanico> @sysint64 btw, there is Xored Inc in your city :)
15:34:15FromGitter<Yardanico> they support Nim a lot and create useful stuff for it
15:36:12YardanicoI love macros :3
15:36:23FromGitter<sysint64> @Yardanico awesome! thanks :)
15:36:41FromGitter<Yardanico> @sysint64 you can also PM me on gitter if you want to ask something in russian :)
15:37:38FromGitter<sysint64> yes, I now about Xored :)
15:42:18*Snircle joined #nim
15:43:07*PMunch joined #nim
15:51:47*PMunch quit (Quit: leaving)
16:19:37FromGitter<Grabli66> I have a string data on server from client websocket. Is there module for reading binary data? For example readUint16, readUnt32, readBytes, readDouble, etc
16:20:56Yardanicoyes
16:20:59Yardanico"streams"
16:21:05Yardanicohttps://nim-lang.org/docs/streams.html
16:21:43Yardanicoyou can read/write chars, bools, int8, int16, int32, int64, float32, float64, string, line
16:22:12FromGitter<Grabli66> Thanks. Now i see.
16:25:18FromGitter<Grabli66> Hhhm. It's strange that package websocket returns string from client for readData procedure, but not a stream. Now i must copy that string to stream.
16:33:08*haha_ joined #nim
16:34:56*def-pri-pub joined #nim
16:38:44*def-pri-pub quit (Client Quit)
16:52:34*def-pri-pub joined #nim
16:54:58def-pri-pubzacharycarter: I can't tell if you're here right now since I'm in IRC and you're probably using gitter, but can you give the timer module more attention right now?
16:55:59*couven92 quit (Ping timeout: 248 seconds)
16:59:47*haha_ quit (Ping timeout: 260 seconds)
16:59:53*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
17:05:05*couven92 joined #nim
17:13:39*def-pri-pub quit (Ping timeout: 240 seconds)
17:15:32*vlad1777d quit (Ping timeout: 260 seconds)
17:15:43*def-pri-pub joined #nim
17:15:43*def-pri-pub quit (Changing host)
17:15:43*def-pri-pub joined #nim
17:20:26*rauss quit (Quit: WeeChat 1.9)
17:21:25*rauss joined #nim
17:23:11*pilne quit (Remote host closed the connection)
17:31:05*def-pri-pub quit (Ping timeout: 240 seconds)
17:31:40*Arrrr quit (Quit: Leaving.)
17:31:55*pilne joined #nim
17:33:17*def-pri-pub joined #nim
17:40:49*def-pri-pub quit (Ping timeout: 248 seconds)
17:42:46*def-pri-pub joined #nim
17:42:46*def-pri-pub quit (Changing host)
17:42:46*def-pri-pub joined #nim
17:43:13*Matthias247 quit (Read error: Connection reset by peer)
17:44:10def-pri-pubI could use a lttle help right now figure out the most efficient way to store a bunch of sprites in a queue to render
17:45:04def-pri-pubSo I have my `Sprite` object which is a `object of RootObj` type, and my `SpriteBatch` object which is the rendering queue
17:45:34def-pri-pubinside of `Spritebatch`, there is a `seq[Sprite]` which is the underlying queue
17:45:52def-pri-pubI'm wondering if it would be more efficient to switch that out to a `seq[Sprite ptr]` instead
17:46:38def-pri-pubWhile the `Sprite` object is kind of small right now, there is the chance that it could grow to be larger. IIRC, when the `seq.add()` method is called, it will copy the value of what's being added in, correct?
17:47:17def-pri-pubAs much as I want to avoid pointer chasing, I think that it's more optimal to instead store a pointer of the sprite I want to render instead of a copy of the sprite itself.
17:50:42def-pri-pubAlso, is it fine to use the unsafe `ptr`, or should I be using `ref objects` instead? Isn't reference counting a tad bit slow?
18:03:10Yardanicomaybe you can use {.shallow.} pragma to remove copying?
18:03:15Yardanicoor shallowCopy somehow
18:05:02FromGitter<Grabli66> Yes. In documentation i saw to use shallow proc on string to prevent string copy.
18:10:26dom96I don't think 'add' copies
18:12:08dom96Indeed, it's easily testable and I am correct: https://gist.github.com/dom96/7f5d7a151c6c116988b9ddb926eb281c
18:12:38dom96def-pri-pub: Are you actually seeing any performance problems right now?
18:16:16def-pri-pubNo
18:16:26def-pri-pubI'm just trying rice it now :]
18:16:42def-pri-pub(thinking for the future)
18:27:39*def-pri-pub quit (Ping timeout: 240 seconds)
18:35:43Yardanicowow
18:36:14YardanicoTIL that ReactOS (free open-source windows-compatible OS) has 14 millions of unit test cases!
18:36:24Yardanico14 MILLIONS
18:38:08Yardanicothat's a nightmare
18:39:27FromGitter<Grabli66> Is it possible to use nim in reactos? :)
18:39:29*rauss quit (Read error: Connection reset by peer)
18:40:00Yardanicoshould be
18:40:10Yardanicosince you can run nimgw on reactos
18:40:21Yardanicobut IIRC ReactOS has unstable command-line
18:40:32YardanicoI mean that cmd.exe command parsers is bad
18:41:12FromGitter<Grabli66> I tried to run reactos on my PC. No luck :). I think it works only in virtual VM
18:41:14*vlad1777d joined #nim
18:41:20*rauss joined #nim
18:41:23Yardanicowell consider how much developers Microsoft have
18:41:36Yardanicoand consider that ReactOS isn't supported by big corporations..
18:41:37Yardanicolike nim
18:41:48Yardanicobut it can already run a whole lot of apps
18:42:03Yardanicoyeah, real hardware is a problem now, but it's becoming only better and better
18:42:15Yardanicoin 1.5-3 years they will have full xp compat
18:50:20*def-pri-pub joined #nim
18:50:20*def-pri-pub quit (Changing host)
18:50:20*def-pri-pub joined #nim
18:52:42Yardanicodom96, quick PoC: (only downloads 30 issues): https://gist.github.com/Yardanico/aa0496653fc687524b3ef014655ffc49
18:53:31Yardanicoit takes first code snippet from the issue, creates folder like "isomeIssueId" - "i1234", and then creates "main.nim" in this folder and "comprun.log"
18:53:45Yardanicocomprun.log contains compiler output
18:53:57dom96cool
18:54:06dom96Nice job :)
18:54:15Yardanicowell nothing fancy here
18:54:21Yardanicoalso I don't need auth for this
18:55:17dom96We should create an issue template: https://github.com/blog/2111-issue-and-pull-request-templates
18:55:50Yardanicomaybe we should firstly see some examples in another repos :)
18:55:55Yardanicobtw rust and crystal don't have these
18:56:05dom96I've never seen any other project do this
18:56:09dom96But I think it's a great idea
18:57:11dom96The hard part is creating a template that isn't too much of a burden
18:57:20dom96And one that is flexible enough to support most issue types
18:57:22Yardanicoyeah
18:57:33dom96But if you're up for it then please create a PR with one :)
18:57:37*PMunch joined #nim
18:58:50Yardanicolol, I didn't notice that I've put my token here :D anyway it had only "public_repo" scope and I deleted it
18:59:17dom96:)
18:59:48dom96btw I added a readme to Nim's tests directory: https://github.com/nim-lang/Nim/tree/devel/tests#readme
19:00:00FromGitter<xmonader> Shouldn't pragma raises propagate to caller methods?
19:00:09Yardanicoit does
19:00:12Yardanicoah
19:00:39FromGitter<xmonader> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59aaffd766c1c7c4770b1b52]
19:01:01FromGitter<xmonader> apparently .get request doesn't have raises pargma
19:01:22Yardanicoehm, and how do you for compiler to add it?
19:01:26Yardanicoedit .nim file? :D
19:01:57dom96xmonader: your code sample doesn't either?
19:02:05Yardanicoah wait
19:02:10Yardanicoyour code wouldn't have any raises pragma
19:02:20Yardanicobecause it "try" "except" every possible exeption
19:02:22Yardanicoexception
19:02:31FromGitter<xmonader> I don't expect the compiler to allow it the .get call without handling it
19:02:46FromGitter<xmonader> The get procedure definition doesn't have "pragma raises"
19:03:01*Nobabs27 joined #nim
19:03:07Yardanicowell Nim allows exception to be thrown
19:03:13Yardanicoyou're not forced to catch all exceptions
19:03:55FromGitter<xmonader> Aha, What about adding raises pragma in the get method defintion?
19:04:10Yardanicoxmonader: try this https://gist.github.com/Yardanico/b2ff6645a67aad7b3d77bad777c98601
19:04:12FromGitter<xmonader> @Yardanico That's the problem I didn't see raises so I expected it'll always be OK
19:04:26Yardanicoyou're not forced to specify {.raises.}
19:04:34Yardanicocompiler does it automatically
19:04:57FromGitter<xmonader> But How can I write code without knowing specific parts may raise an exception?
19:05:14Yardanicoand after that snippet try this: https://gist.github.com/Yardanico/d2aba602c306910bd188d6f3c90d28ba
19:05:17Yardanicoas usual lol
19:05:25Yardanicomy second gist would work
19:05:33Yardanicobecause you've wrapped everything in try/except
19:05:39Yardanicoand first wouldn't
19:05:56Yardanicoxmonader: Nim has exceptions, and they can be thrown
19:06:05Yardanicojava/python have exceptions too
19:06:20Yardanicojs/c++/etc
19:06:39FromGitter<xmonader> @Yardanico :) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ab013f8f4427b462c6e26f]
19:07:05FromGitter<Yardanico> and? I know that it doesn't have raises pragma because it doesn't need to do it
19:07:08dom96the compiler infers what exceptions are raised.
19:07:30dom96https://nim-lang.org/docs/httpclient.html#get,AsyncHttpClient,string
19:07:34dom96Click the `{..}`
19:07:37FromGitter<Yardanico> https://nim-lang.org/docs/tut2.html#exceptions-annotating-procs-with-raised-exceptions
19:07:49dom96(That really needs a style that gives it an underline)
19:08:01FromGitter<Yardanico> also you can add pragma {.effects.} to your proc
19:08:07FromGitter<Yardanico> and compiler will print all effects of this proc
19:08:12mahmudovzmq lib is on usage ?
19:08:13FromGitter<Yardanico> including possible exceptions
19:08:34mahmudovi cant communicate python-cli and nim-server via zeromq
19:08:43FromGitter<xmonader> Yeah, maybe my IDE is just not good enough to give me hints about possible exceptions, if the compiler already infers it
19:08:54Yardanicowhy it should give hints?
19:08:57Yardanicoand btw it can do it
19:09:03Yardanicoadd {.effects.} pragma to your proc
19:09:15Yardanicooh
19:10:01Yardanicoah
19:10:06YardanicoAdd {.effects.} to the end of your proc
19:10:13Yardanicoand compiler will show all effects/exceptions
19:10:29YardanicoI don't really know WHY you need IDE to specify that exceptions can be thrown
19:10:56YardanicoI mean why do you need this? even pycharm ide (biggest ide for python) doesn't have that
19:11:07dom96xmonader: are you coming from Java?
19:11:43FromGitter<xmonader> @dom96 I'm mainly a pythonista, but yes, I used java in the past.
19:12:01Yardanicowell do you handle all possible exceptions in python? :D
19:12:06FromGitter<xmonader> @Yardanico Nim is a static language, the type system should help me write code
19:12:25Yardanicoehm, I still don't get it
19:12:46Yardanicohow can possible exceptions help you with writing code?
19:12:55Yardanicoalso maybe Araq can explain it better
19:13:04YardanicoI don't use "raises" at all, and yes, I came from python
19:13:09dom96Nim's checked exceptions are opt-in
19:13:16dom96Unlike Java's
19:13:22dom96Java forces you to handle them everywhere
19:13:58FromGitter<xmonader> @Yardanico I mean as a static language It can provide me with all of possible edge cases "exceptions" that can raise. So i handle those from very beginning not worrying about those failure entry points
19:14:15FromGitter<xmonader> @dom96 Uha, Thank you :)
19:14:23Yardanicoadd {.effects.} to the end of your proc
19:14:24dom96You just need to ask it to do that by annotating your proc with {.raises: [].}
19:14:31Yardanicodom96, this would be too hard
19:14:41dom96Yardanico: how so?
19:14:44Yardanicocompile-see one exception - add it to raises or handle it - compile again
19:14:47Yardanicobetter to use {.effects.}
19:15:36Yardanicoeffects would print all possible exceptions, and places where these exceptions can be thrown raised
19:15:38Yardanicoexample
19:15:41*yglukhov joined #nim
19:15:42Yardanicolib/pure/httpclient.nim(1104, 9) Hint: ref HttpRequestError [User]
19:15:57Yardanicoand this for every possible exception/effect
19:17:09*def-pri-pub quit (Ping timeout: 240 seconds)
19:17:26Yardanicoxmonader: Nim already does a lot of compile-time checking
19:17:50FromGitter<xmonader> @Yardanico I see {.effects.} pragama is amazing. Didn't know it exists in the first place
19:17:59FromGitter<xmonader> Thank you all :)
19:17:59Yardanicoread manual :)
19:18:19FromGitter<xmonader> I read lots of it, maybe I skipped/assumed some parts.
19:18:57Yardanicoalso btw I've never used effects before, and I'm amazed that it prints line numbers
19:19:01Yardanicowhere exceptions are thrown
19:19:08*def-pri-pub joined #nim
19:19:08*def-pri-pub quit (Changing host)
19:19:08*def-pri-pub joined #nim
19:19:23dom96cool :)
19:20:56*Nobabs27 quit (Quit: Leaving)
19:24:22*couven92 quit (Ping timeout: 264 seconds)
19:34:48*def-pri-pub quit (Ping timeout: 252 seconds)
19:36:38*def-pri-pub joined #nim
19:37:07FromGitter<ephja> it's the future!
19:48:33def-pri-pubzacharycarter: posted a PR for the sprite stuff (partial) and added a new issue or two on the tracker that really needs some addressing
19:54:38FromGitter<xmonader> linkchecker.nim(34, 27) Error: cannot create a flowVar of type: tuple[link: string, state: bool] any idea why?
19:54:44*Elronnd quit (Quit: Killed (SIGILL))
19:58:05*def-pri-pub quit (Ping timeout: 240 seconds)
20:00:20*def-pri-pub joined #nim
20:01:08FromGitter<adamrezich> is there a way to unpack tuples and declare the variables that you're unpacking them into in one line?
20:02:14FromGitter<adamrezich> nevermind i'm a moron
20:02:35FromGitter<adamrezich> (still though I don't think I saw it in the manual)
20:03:33FromGitter<adamrezich> nevermind, now I see it -__-
20:03:36Yardanicowell it's not as nice as in python, but you can still do it
20:03:37Yardanicoalso
20:03:50Yardanicoif you want to unpack a seq - you can use simple macro
20:03:53Yardanicoone sec :)
20:05:04Yardanicoadamrezich: https://gist.github.com/Yardanico/3ed3f8d8b6ccd070afd67e8bd26f2914
20:05:28Yardanicobut it would fail with index out of bounds error if you have incorrect number of arguments in extract
20:05:37FromGitter<adamrezich> oh that's pretty neat
20:05:48Yardanicooh waitr
20:05:51Yardaniconot "extract"
20:05:52Yardanicounpack
20:06:30Yardanicoah, you're probably using 0.17.0
20:06:33Yardanicothis would fail for you
20:06:34Yardanicoone sec :)
20:06:58Yardanicohttps://play.nim-lang.org/?gist=335eb72a3a9d11a497ed0a5e662411de
20:07:34FromGitter<xmonader> apparently I can't use tuples in FlowVars, only ref objects are allowed.
20:07:47Yardanicoxmonader: why you don't use async?
20:07:53Yardanicoit's better for IO
20:08:07FromGitter<xmonader> @Yardanico it's the upcoming one.
20:08:26Yardanicowell "spawn" is thread-based
20:08:31Yardanicoasync is coroutine-based
20:08:51FromGitter<xmonader> Also, I want to use channel with spawns
20:09:18FromGitter<xmonader> @Yardanico yeah, I'm creating simple example for "sequential", thread-based, and async links checker
20:10:57*def-pri-pub quit (Quit: leaving)
20:11:32FromGitter<adamrezich> @Yardanico nice, I'll keep that in mind for future use :)
20:12:03Yardanicowell you can do almost everything with macros
20:12:10Yardanicoas long as it's a valid nim syntax
20:12:30Yardanicowell if it's not - you can use strings :D
20:14:22*mahmudov quit (Ping timeout: 246 seconds)
20:14:41*mahsav quit (Ping timeout: 240 seconds)
20:26:37*mahmudov joined #nim
20:26:42*haha_ joined #nim
20:31:15ehmrywith the big three OSen, not pinning a Nim thread to a CPU assumes that the OS will freely schedule the thread on an arbitrary CPU, yes?
20:33:15YardanicoEastByte, I guess so
20:33:22*ipjk_ quit (Ping timeout: 264 seconds)
20:33:31PMunchWell probably not an arbitrary one, but the one with the least use at the moment
20:33:38Yardaniconim threads are os threads AFAIK
20:33:49PMunchThink so yeah
20:34:38Yardanicodom96, btw, about issue template: I'm thinking of something like *special* comments in code snippets
20:34:46Yardanicoso like:
20:34:53Yardanico# filename a.nim
20:34:58ehmryok, cook
20:35:02ehmry*cool
20:35:04Yardanico# compile nim c --threads:on -r a.nim
20:35:37*ipjk joined #nim
20:37:02Yardanicoalso maybe
20:37:33Yardanico# packages strfmt
20:37:36Yardanicofor nimble packages
20:37:36mahmudovAraq i tested nim-zmq with python.nim's implementation seems outdated
20:37:42*Matthias247 joined #nim
20:38:07*haha_ quit (Quit: haha_)
20:39:52dom96Yardanico: maybe you could reuse testament's spec parser? :)
20:40:18FromGitter<xmonader> Quick question: I can't call await on asyncResponse? Only on flowvars?
20:40:19Yardanicodom96, well I think it would be a bit too verbose
20:40:38dom96why?
20:40:38Yardanicoxmonader: AsyncResponse from httpclient?
20:40:41Yardanicoyou can
20:40:46FromGitter<xmonader> yes
20:40:48Araqmahmudov: fix it
20:40:52Yardanicoasyncdispatch module
20:41:08dom96xmonader: you can but only in an async proc
20:41:47FromGitter<xmonader> wait? I can't have threadpool and asyncdispatch in the same file? or should I call it by it's fully qualified name? asyncdispatch.await?
20:42:01Yardanicoyou sure can
20:42:01Yardanicoyes
20:42:05Yardanicoor maybe no
20:42:12Yardaniconim probably can figure out this by himself
20:42:36Yardanicobecause awaits from asyncdispatch and threadpool have different arguments
20:43:09FromGitter<xmonader> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ab17dd162adb6d2e5f458b]
20:43:22Yardanicodid you import asyncdispatch?
20:43:27FromGitter<xmonader> yes
20:43:36Yardanicoah
20:43:40Yardanicoyour proc should be async as dom96 said
20:43:43Yardanico{.async.} pragma
20:45:48FromGitter<xmonader>
20:46:43*vivus joined #nim
20:48:37Yardanicodom96, yeah, testament parsing code looks clean
20:48:46Yardanicoalso good thing that it's not dependent on compiler
20:48:52Yardanicoonly on stdlib
20:49:19dom96in fact, why don't you just save the code from the issue and use testament to test it :)
20:49:45Yardanicowell I think users would be lazy to provide correct testament config
20:50:02Yardanicoe.g. typing all these "line", "column"
20:50:10dom96hrm?
20:50:16dom96don't know what those are
20:50:19dom96never had to use them
20:50:44Yardanicohttps://github.com/nim-lang/Nim/blob/2aa31869b6c7b97408c93d2553531cbe02bab376/tests/parser/twrongcmdsyntax.nim
20:50:47dom96an additional advantage that this brings is that we can just copy the code and add it as a test case
20:50:52Yardanicowell yeah
20:50:58Yardanicothat's that I was thinking about
20:51:02dom96pretty sure that's optional
20:51:12Yardanicowell yeah
20:51:19Yardanicobut it would help in some issues
20:51:26Yardanicothere are issues with incorrect error messages :)
20:51:36Yardanico*with incorrect line numbers
20:51:39Yardanicoin error messages
20:51:41dom96okay, well some users will be lazy yes
20:51:46dom96You can't do anything about that
20:51:54dom96and it's not a reason to not use testament
20:52:16YardanicoI'll see if I can use testament separately from compiler
20:52:26Yardanicohmm probably I can
20:52:34Yardanicoit only imports one thing from the compiler
20:52:36Yardanico"compiler/nodejs"
20:52:47*yglukhov quit (Remote host closed the connection)
20:55:06dom96Like I said, just use testament directly
20:55:19dom96Save the code in tfile.nim
20:55:28Yardanicoyeah
20:55:34dom96put it in some new directory under $nim/tests/
20:55:43dom96then run ./koch tests cat <new_dir_name>
20:56:21*Elronnd joined #nim
20:59:48Yardanicothanks to Parashurama we can now run pure nim bigints at compile-time! yay https://github.com/nim-lang/Nim/pull/6224
20:59:56YardanicoI've tested and it WORKS!
21:09:31*PMunch quit (Quit: leaving)
21:10:01def-Yardanico: very cool
21:13:29*yglukhov joined #nim
21:14:48Yardanicodef-, also I'm amazed about this
21:14:51Yardanico"We're about twice as slow as GMP in these microbenchmarks"
21:14:57Yardanicoyour bigints doesn't even contain a line of C code
21:15:12def-it's not about using C code
21:15:17Yardanicoand it's only 2x slower than mega-optimized GMP version
21:15:30Yardanicomaybe GMP uses some SSE like things?
21:15:43def-It's about GMP having many years of optimizations, vectorization, etc
21:15:44def-yeah
21:16:00Yardanicoalso can I divide one bigint by another?
21:16:22def-yes
21:16:42Yardanicodef-, how ? :P
21:16:50Yardanicothere's no `/` proc
21:16:54def-`div`
21:17:01Yardanicoah, ok
21:17:04def-a div b
21:17:29def-is for float division in Nim
21:17:34def- /
21:17:44Yardanicoah
21:20:19*Yardanico quit (Remote host closed the connection)
21:21:35*xet7 quit (Ping timeout: 248 seconds)
21:22:19dom96hey def-. What are you working on these days? :)
21:22:27def-hi dom96
21:22:44def-work, DDNet, nothing new
21:25:01dom96Ahh :)
21:25:32def-congrats on the book release, dom96
21:25:50dom96thanks, did you get a copy?
21:26:12def-nope
21:26:32*skrylar joined #nim
21:26:35def-You gave me access to the digital version though
21:26:40dom96It's 50% off today in case you're interested.
21:34:48*xet7 joined #nim
21:37:03*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
21:37:27*claudiuinberlin joined #nim
21:44:36*Sentreen quit (Ping timeout: 252 seconds)
21:49:31FromGitter<xmonader> linkchecker.nim(49, 88) template/generic instantiation from here ⏎ lib/pure/asyncmacro.nim(19, 10) Error: index out of bounds
21:49:43FromGitter<xmonader> ``````
21:55:15FromGitter<Yardanico> You need to show us whole proc code sadly
21:55:35FromGitter<Yardanico> Do you use await in a try block?
21:55:51FromGitter<xmonader> yes -_-
21:56:22FromGitter<xmonader> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ab2906bac826f05473bdbd]
21:56:31FromGitter<Yardanico> You can't do that
21:56:45FromGitter<Yardanico> Check asyncdispatch focs
21:56:47FromGitter<Yardanico> Docs
21:56:52*skrylar cringes.
21:57:01FromGitter<xmonader> What's the idiomatic way?
21:57:10FromGitter<Yardanico> There's info about how to handle future errors
21:57:32FromGitter<Yardanico> https://nim-lang.org/docs/asyncdispatch.html#ans
21:57:34FromGitter<Yardanico> synchronous-procedures-handling-excepti
21:57:37*Sentreen joined #nim
21:57:39FromGitter<Yardanico> Sorry
21:57:41FromGitter<Yardanico> https://nim-lang.org/docs/asyncdispatch.html#asynchronous-procedures-handling-exceptions
21:57:54FromGitter<xmonader> Thank you I'll check
22:02:41*dom96 is impressed that this is documented
22:08:36skrylarit sounds like async is cancer
22:10:23dom96Wow, that's a bit dramatic.
22:10:56skrylari dunno, every time someone asks about it there's some serious issue or another
22:11:19skrylarstarting to wonder if it actually works or one might as well just use a work queue
22:11:25FromGitter<Yardanico> Well it's not easy to create async/await with s macro :)
22:11:29FromGitter<Yardanico> Yeah it works
22:12:11FromGitter<Yardanico> One thing that I've noticed - most of compiler/some stdlib modules don't have comments (only a few)
22:12:28FromGitter<Yardanico> I mean in their source
22:12:52*yglukhov quit (Remote host closed the connection)
22:13:29FromGitter<Yardanico> And I can't think how I would use work queue for my async app :)
22:13:35dom96skrylar: Of course it works. The forum and NimBot both run on it.
22:13:56dom96!ping
22:13:56NimBotpong
22:13:56FromGitter<Yardanico> !ping
22:14:00dom96!lag
22:14:00NimBot30ms between me and the server.
22:14:05FromGitter<Yardanico> Hah
22:14:16FromGitter<Yardanico> We're sent !ping at the same time
22:14:17dom96Won't work through gitter :)
22:14:22FromGitter<Yardanico> Yeah
22:14:50*Yardanico joined #nim
22:15:08Yardanico!lag
22:15:08NimBot29ms between me and the server.
22:15:39skrylarYardanico: i get to finally deal with multi-core processing in nim the next time i do any AI work :\
22:15:54skrylarimplementing A3C after this one layer of neurons is fixed
22:16:08FromGitter<Yardanico> Well async is not about multi threading and calculations
22:16:19FromGitter<Yardanico> It's about IO mostly
22:16:36skrylarthis current generation of AI terrifies me
22:16:44skrylarand is somewhat depressing
22:17:02skrylari think the paper said A3C became a master pong player in 30 minutes
22:18:10dom96Huh, it terrifies you as in you're afraid that the storyline of Terminator will happen?
22:18:44skrylarIts depressing because people spent their whole lives or years trying to "gitgud" and then a random AI hits grand master in Dota 2 after what, a couple weeks of training rounds?
22:18:48skrylarI mean these things NEVER sleep
22:19:44skrylarthe possibilities seem to either be 1) the kurzweilian transhumanists (and/or elon) win, and we just have brain addons for everyone or 2) the businessmen just use them to replace us
22:20:42FromGitter<Yardanico> Well it uses special framework for bots? Or it only gets image of display as input?!
22:20:56skrylaron pong its pixel input
22:21:05FromGitter<xmonader> if I do yield future is it equivalent to await future?
22:21:15FromGitter<Yardanico> No
22:21:22FromGitter<xmonader> if so how can i retrieve the success value?
22:21:31FromGitter<Yardanico> future.read()
22:21:40FromGitter<Yardanico> after you've yielded it
22:21:49FromGitter<xmonader> but I can't do await after the yield correct?
22:21:59skrylari'm basically a trash tier programmer and i can follow these papers and build (to a limited extent) some of this stuff, so its sort of spoopy. for instance, have a look at the SMASH paper
22:22:08FromGitter<Yardanico> Yes, you can't, why do you need it?
22:22:41FromGitter<Yardanico> By yield you're executing a future
22:22:50skrylarhttps://arxiv.org/abs/1708.05344
22:22:51dom96skrylar: I wasn't impressed by the Dota 2 AI at all.
22:23:12dom96And people beat it very quickly
22:23:31dom96I'll be impressed if they manage to win a 5v5
22:23:41dom96without any restrictions
22:23:52skrylarUh, not Valve's AI
22:23:56skrylarOpenAI did it. Beat a master.
22:23:57dom96I know
22:25:03FromGitter<Yardanico> A bit offtopic: I've learned most
22:25:13dom96From what i've read about it, others weren't impressed either.
22:25:31skrylarthat's not what i read /shrug
22:26:25dom96https://news.ycombinator.com/item?id=14995832
22:26:40skrylarWell, I do know of two problems they have; one is that self play is tediously ineffective, and they don't run in continuous learning mode
22:28:02skrylarI think it was the paper for Giraffe (a chess bot) where they did empirical analysis of self play v. mentored, and found that self-play tends to make strange decisions and compound them while having it fight things like knightcap resulted in more sane results
22:28:24skrylarBut there's a lot more compute requirements to generate multiple seed AIs and make those fight each other
22:28:25FromGitter<Yardanico> A bit offtopic: I've leaned English only as a result of using computer (and programming of course) :D So sometimes I know the meaning of a word
22:28:39FromGitter<Yardanico> Eh
22:28:44skrylareach network is its own weird beast.
22:28:47FromGitter<Yardanico> Gitter on mobile sucks
22:28:51skrylargitter sucks :>
22:28:57FromGitter<Yardanico> Going to irc
22:29:14skrylarsometimes you roll a random set of weights and it converges super fast, some generate and are functionally retarded
22:29:16skrylarlife is weird
22:31:56FromGitter<xmonader> ```code paste, see link``` ⏎ ⏎ this code freezes :S [https://gitter.im/nim-lang/Nim?at=59ab315cba0f0f6e380e883f]
22:31:56Yardanicoso basically I wanted to say that sometimes I know the meaning of some English word only in computer context because I've learned English from using internet/ programming
22:33:27skrylaryou're supposed to learn them by playing sierra adventure games :^)
22:33:35FromGitter<Yardanico> xmonader: sadly I can't help you now because I'm from the phone
22:33:50*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
22:33:59Yardanicoskrylar: yeah, games too
22:34:06FromGitter<xmonader> @Yardanico It's okay :(
22:35:21*miran quit (Ping timeout: 240 seconds)
22:35:45Yardanicobtw in Russia in most of the schools students have English as a foreign language
22:36:13Yardanicome too
22:36:53Yardanicobut this doesn't really makes much sense for me:)
22:37:51skrylari tried learning other human languages
22:39:12dom96xmonader: can you gist the full code?
22:39:19Yardanicoand it didn't go well? :)
22:40:38FromGitter<xmonader> @dom96 https://gist.github.com/xmonader/e14e3234157b727d63f2d7eb8955b0a2
22:41:20FromGitter<xmonader> problem is with asyncLinksChecker/checkLinkAsync it never ends
22:41:29skrylarYardanico, you really have to have a need for them
22:41:40FromGitter<xmonader> well, it gave me once the time but then it stopped for good
22:41:43Yardanicooh wait xmobader
22:41:59Yardanicohow are you calling this proc?
22:42:31Yardanicoare you using runForever() maybe?
22:43:20FromGitter<xmonader> @Yardanico nope just regular call
22:43:40dom96that doesn't compile for me
22:43:46FromGitter<xmonader> I'm folllowing this https://github.com/nim-lang/Nim/blob/devel/tests/async/tasyncall.nim#L47
22:43:52dom96a4.nim(50, 22) Error: type mismatch: got (Future[Future[a4.result]], result)
22:44:08FromGitter<xmonader> really? ```Hint: operation successful (42961 lines compiled; 1.733 sec total; 85.547MiB peakmem; Debug Build) [SuccessX] ⏎ Hint: /home/striky/wspace/nim101/linkchecker [Exec] ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=59ab3438614889d475b4bea6]
22:45:00FromGitter<xmonader> @dom96 nim c -r --threads:on -d:ssl
22:45:04Yardanicoxmonader: well you can't just call an async proc like that :)
22:45:07*Pwntus_ joined #nim
22:45:16*Pwntus_ quit (Client Quit)
22:45:44Yardanicouse "waitFor myProc()" if you want to block current thread until this proc finishes
22:46:00dom96interesting.
22:46:03dom96Compiles in 0.17.0
22:46:05dom96but not in devel
22:46:09Yardanicoor asyncCheck myProc() if you don't want to block it
22:46:09FromGitter<xmonader> @Yardanico but i use waitFor already in the other process
22:46:29Yardanicodom96: probably because of result?
22:46:39dom96yeah, I wouldn't be surprised
22:46:51dom96Naming your type `result` is a bad idea
22:47:05FromGitter<xmonader> is it because it's the same as pascal's return name?
22:47:13FromGitter<xmonader> sorry nim's**
22:47:27Yardanicoprobably it is
22:47:32Yardanicoand btw
22:47:38dom96yeah, that is the reason
22:47:43dom96And the error is just weird in devel
22:47:44Yardanicoyou don't need to use void return type
22:47:47dom96works in 0.17.0
22:48:00dom96yes
22:48:05Yardanicoits optional
22:48:08dom96`result` is implicitly defined
22:50:26dom96also it works fine on my machine
22:50:32dom96after I rename the type to Result
22:51:32dom96but the fact that this compiles is surprising
22:51:45dom96You've got
22:51:46dom96proc checkLinkAsync(link: string, client:AsyncHttpClient): Future[Result]
22:51:56dom96proc checkLink(link: string, client:HttpClient | AsyncHttpClient) : Result
22:52:13dom96oh thought they had the same names heh
22:52:20dom96It's getting late
22:52:50dom96You should remove '| AsyncHttpClient' though
22:53:06FromGitter<xmonader> @dom96 I renamed it. Problem is if i keep the async code part in the whenIsMainModule it never returns
22:53:29FromGitter<xmonader> when i keep all the other parts checkSequentially and threadsCheck it continues and exits
22:54:04dom96I tried with both 0.17.0 and devel and it's working
22:57:12FromGitter<xmonader> https://imgur.com/a/sFZZQ :( sad on 0.17.0
22:57:38*themagician quit ()
22:58:22FromGitter<xmonader> @dom96 can you try this? https://gist.github.com/xmonader/10cd5ccbc7f24b35910010e0dccca71a and tell me if it exits cleanly on ur machine?
22:58:57dom96yep, works fine
22:59:08dom96Maybe it's a OS-specific issue? what OS are you on?
22:59:20FromGitter<xmonader> I'm on archlinux
23:00:21dom96Anybody else on Linux that can test this?
23:02:09*vlad1777d quit (Remote host closed the connection)
23:03:36FromGitter<xmonader> @dom96 What OS do you use?
23:04:25dom96macOS
23:05:25FromGitter<qqtop> openSuse Tumbleweed on 0.17.1 : works fine
23:06:03dom96weird
23:06:50FromGitter<xmonader> @qqtop suse also uses the rolling release model so i expect u to have the latest packages as well
23:07:06FromGitter<xmonader> @dom96 what other information can I provide u with?
23:09:11dom96Not sure. I think the best thing for you to do is try getting Nim devel and see if it works there.
23:09:47FromGitter<xmonader> Sure. let me try that
23:10:21FromGitter<xmonader> Should I use choosenim or manually?
23:10:31dom96choosenim might be easier
23:10:49dom96just make sure you remove the old installation well
23:11:17FromGitter<xmonader> okay thank you
23:13:20FromGitter<xmonader> Internet is so great in Egypt :(
23:13:49FromGitter<abijahm> hello guys, how would implement a type that holds items of different types
23:14:38FromGitter<Yardanico> Wait
23:14:58FromGitter<Yardanico> You want to have a sequence of items with different types?
23:15:14FromGitter<xmonader> That's a tuple :D
23:15:14FromGitter<Yardanico> Like [1, "hi"] in python?
23:16:13FromGitter<abijahm> no a table of items of different types with keys
23:16:41FromGitter<xmonader> In python it depends on if the key is hashable only. not sure about nim
23:17:21FromGitter<Yardanico> Well you can do almost the same thing with object variants
23:17:45FromGitter<Yardanico> But please don't forget that Nim is a compiled language without runtime vm
23:18:07FromGitter<Yardanico> So you can't for example have a sequence of different types
23:19:13FromGitter<abijahm> or maybe i will have to transform the objects to JsonNodes
23:19:33FromGitter<Yardanico> Also wait, what are you using table for?
23:19:41FromGitter<Yardanico> Pattern matching?
23:20:37dom96Indeed, you need an object variant
23:20:48dom96So you likely can reuse JsonNode for your purposes.
23:22:12FromGitter<abijahm> no am trying to implement a middleware stack for asynchttpserver like express am using a table to store the context
23:23:46dom96what does this context contain?
23:27:56FromGitter<abijahm> objects parsed from a request eg form data into a object
23:28:26FromGitter<abijahm> from a http request
23:29:17dom96That's all mostly a Table[string, string], no?
23:29:31*Snircle joined #nim
23:29:42dom96You shouldn't have trouble with that and types.
23:31:10*Yardanico quit (Read error: Connection reset by peer)
23:31:32FromGitter<xmonader> How big is the nim devel :D ?
23:32:42*TjYoco joined #nim
23:32:58dom96xmonader: how fast is it downloading for you? :)
23:33:26FromGitter<xmonader> 24mb 208kb/s :S
23:38:36dom96Might take some time unfortunately
23:39:35FromGitter<xmonader> It's okay I may take extra nap xD
23:41:10FromGitter<xmonader> @dom96 are there any documentation on the internals of nim and the development process?
23:41:35FromGitter<xmonader> I'm pretty curious about the generated C code as well, how do I get more insights?
23:41:39dom96https://nim-lang.org/docs/intern.html
23:41:46dom96That has some info
23:42:13FromGitter<xmonader> Oh Thank you ^_^
23:45:05FromGitter<xmonader> Sad day, ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Freezes on devel :S [https://gitter.im/nim-lang/Nim?at=59ab428066c1c7c4770c010d]
23:45:57*nsf quit (Quit: WeeChat 1.9)
23:50:51dom96You sure your internet just isn't super slow? :)
23:51:09dom96what stack trace do you get when you terminate it?
23:51:53FromGitter<xmonader> It took like 15 mins :S
23:52:03FromGitter<xmonader> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ab4423614889d475b4f20b]
23:52:10*relax joined #nim
23:53:08dom96one quick thing you can try: compile with -d:upcoming
23:53:44*thomasross joined #nim
23:54:07FromGitter<xmonader> sorry didn't work
23:54:14FromGitter<xmonader> what's is that flag for
23:58:06dom96It uses a slightly newer async dispatcher
23:58:22dom96only thing you can do now is debug this I'm afraid
23:58:25dom96you can use strace for this
23:58:42dom96or start adding debug statements throughout your code (and the stdlibs code) to see what's going on
23:59:20FromGitter<xmonader> I shall! Thank you a lot @dom96 I'll keep you guys posted about this
23:59:55*TjYoco quit (Quit: Page closed)