00:15:04 | * | loc8_ joined #nim |
00:18:01 | * | loc8 quit (Ping timeout: 240 seconds) |
00:20:45 | TheManiac | Awesome 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:47 | FromGitter | <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:07 | FromGitter | <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:07 | FromGitter | ... ⏎ 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:16 | FromGitter | <Sud0nim> Hmm, sorry markdown didn't work |
04:30:41 | FromGitter | <Sud0nim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59aa33f1ee5c9a4c5f25114c] |
04:30:58 | FromGitter | <Sud0nim> That is the wrapped proc, meanwhile this is the header file definition: |
04:31:14 | FromGitter | <Sud0nim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59aa3412ee5c9a4c5f251189] |
04:35:06 | FromGitter | <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:59 | FromGitter | <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:52 | FromGitter | <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:49 | FromGitter | <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:01 | Yardanico | hi |
09:21:35 | * | gangstacat joined #nim |
09:21:36 | couven92 | Yardanico, hi! :) You stalking me? (you logged in about 5 seconds after me :P ) |
09:22:00 | Yardanico | couven92, no, just came from the school :) |
09:22:13 | couven92 | on a saturday? |
09:22:17 | Yardanico | yeah |
09:22:32 | Yardanico | I live in Russia |
09:22:50 | couven92 | they have school on sayurday? |
09:22:58 | Yardanico | yes |
09:23:18 | couven92 | Hmm... I didn't know... |
09:23:33 | couven92 | Wow, now even I learned something this weekend! :O |
09:23:49 | Yardanico | we have school at all days except sunday |
09:24:41 | couven92 | Hmmm... I went to school with a guy that grew in Moscow... he never told me that... |
09:24:48 | couven92 | *grew up |
09:25:35 | * | Ven joined #nim |
09:26:00 | * | Ven is now known as Guest66504 |
09:26:21 | Yardanico | well most of our schools are public schools (funded by the government), we have 11 grades |
09:26:31 | Yardanico | well 10 and 11 are optional |
09:26:37 | Yardanico | you can go to college instead |
09:27:23 | Yardanico | also "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:19 | couven92 | ah... yeah, here in Norway, we have 10 mandatory years and then 3 more for university entry qualification |
09:28:57 | couven92 | Used to have that in Germany, too when I went to school, but they changed it from 13 to 12 years now. |
09:31:14 | Arrrr | School in saturday? Are people in Russia more intelligent? |
09:36:18 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
09:44:07 | Yardanico | Arrrr, well I can't answer questions like that, but a lot of intelligent russian people emigrate to other countries |
09:44:16 | Yardanico | for example programmers |
09:44:46 | Yardanico | because salaries are not very high |
09:45:05 | Yardanico | so we have "brain drain" in russia |
09:45:38 | Yardanico | but I don't really think that studying 6vs5 days has that much difference |
09:46:04 | Yardanico | btw, you can read there - https://en.wikipedia.org/wiki/Education_in_Russia |
09:47:14 | Arrrr | Thanks |
09:47:15 | miran | hi guys, it's me and my beginner questions again :) |
09:47:39 | miran | var columns: array[8, string] |
09:47:46 | miran | for i, _ in columns: |
09:47:47 | miran | columns[i] = "" |
09:48:17 | miran | any more intelligent way to do this? (i want to have empty strings so i can add characters to it later) |
09:48:23 | Yardanico | miran, yeah |
09:49:01 | Yardanico | miran, https://nim-lang.org/docs/algorithm.html |
09:49:05 | Yardanico | proc fill[T](a: var openArray[T]; value: T) |
09:49:17 | Yardanico | but you'll an additional import for this :) |
09:49:43 | miran | i'll aready have algorithm import because i use `sorted` |
09:50:08 | Arrrr | Another way: for str in mitems(columns): str = "" |
09:50:35 | Yardanico | yeah, mitems allows you to modify value for current iteration |
09:51:23 | miran | thanks Arrrr! |
09:52:02 | Yardanico | also eventually seq and string will have default values |
09:52:14 | Yardanico | so you wouldn't need to initialise them |
09:52:23 | miran | i guess this could do it too: |
09:52:28 | miran | var columns = ["", "", "", "", "", "", "", ""] :) |
09:52:31 | Yardanico | yeah |
09:52:36 | Yardanico | but this is less elegant :) |
09:52:45 | miran | easy when there are 8 items, and not 800 ;) |
09:53:16 | miran | "also eventually seq and string will have default values" -> this would be great! (from my very limited experience with nim) |
09:53:44 | Yardanico | well it would be just an exception |
09:53:50 | Yardanico | because seqs and strings are widely used |
09:54:02 | Yardanico | so less SIGSEGVs |
09:55:09 | miran | i see SIGSEGV couple of times each day :) |
09:55:36 | miran | i thought that's because of me and my python background :) |
09:55:40 | Yardanico | well they come from uninitialised values |
09:55:47 | Yardanico | python doesn't have a thing like that (only None) |
09:55:48 | Yardanico | btw |
09:55:55 | Yardanico | you can turn "sigsegv" into "nil access error" |
09:56:20 | Yardanico | just import module "segfaults" |
09:56:51 | miran | i 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:17 | Yardanico | miran, well "segfaults" module is needed if you want to catch SIGSEGV as a proper exception |
09:57:25 | Yardanico | but I doubt it will work 100% of time |
09:57:48 | Yardanico | I mean in most of cases it would throw a proper error that you can catch |
09:58:01 | Yardanico | miran, nim has default values only for value types currently |
09:58:10 | Yardanico | basically everything that is not "ref" or "ptr" |
09:58:11 | miran | currently my proc's are filled with `result = @[]` or `result = ""` |
09:59:39 | Arrrr | most programming languages requires initialization of pointers. |
10:00:18 | miran | and for a language that is otherwise quite elegant, this slightly decreases the elegance |
10:00:20 | Yardanico | Arrrr, well, a lot of newbies coming from Python (btw I came from python too) don't understand this at the beginning |
10:00:35 | Yardanico | because they've never worked with languages like C/C++ (neither did I) |
10:00:40 | Arrrr | Ah, that explains the thing |
10:01:02 | miran | yep, python 'spoiled' me in that way |
10:01:33 | miran | and i really like nim because it takes some of that python-elegance and ease-to-use |
10:01:36 | Arrrr | Well, it depends on why do you need nim. I need it for the performance, so i accept controlling when to allocate memory. |
10:02:06 | Yardanico | most of python syntax is valid in Nim (I'm about AST) |
10:02:35 | Yardanico | proof: https://github.com/Yardanico/nimpylib/blob/master/examples/example2.nim |
10:03:01 | * | Guest66504 quit (Ping timeout: 240 seconds) |
10:03:18 | miran | Yardanico: yep, it took some time to realize that's not python code :D :D |
10:03:32 | Yardanico | miran, but please don't use it in real nim code, it's just an experiment :) |
10:03:53 | miran | :) |
10:04:02 | Yardanico | I 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:17 | FromGitter | <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:34 | Yardanico | hmm, probably not with a template |
10:33:45 | Yardanico | but with a macro :) |
10:33:55 | Yardanico | but I may be wrong |
10:34:08 | Yardanico | ephja: how you want to call this template? |
10:34:13 | Yardanico | t(x: int, y: bool) |
10:34:14 | Yardanico | like this? |
10:34:57 | Yardanico | this wouldn't work AFAIK |
10:35:27 | Yardanico | It's not a correct syntax |
10:41:00 | FromGitter | <ephja> it would have to be t((args...)) then |
10:41:23 | Yardanico | yeah |
10:41:34 | Yardanico | but 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:48 | FromGitter | <ephja> no you can't atm, and perhaps you would have to do "proc args" instead if it had worked |
11:19:11 | dom96 | wow, school on a saturday, that's really weird. |
11:19:18 | dom96 | Do Russians work on saturdays as well? |
11:19:35 | dom96 | Do you stay in school less at least? |
11:19:44 | dom96 | like, 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:10 | dom96 | Hrm, 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:42 | dom96 | Anyone want to create this as a project? :) |
11:27:48 | dom96 | Yardanico: Perhaps you? |
11:29:31 | Yardanico | dom96, 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:04 | dom96 | Yardanico: "Years 8 - 11" is I think how the English refer to them :) |
11:30:12 | dom96 | or maybe even "School Years" |
11:30:16 | dom96 | since it's not the person's age |
11:30:21 | Yardanico | ah, ok |
11:30:58 | dom96 | wait, sunday? |
11:31:06 | Yardanico | ah |
11:31:07 | Yardanico | sorry :D |
11:31:11 | Yardanico | nonono |
11:31:17 | dom96 | You mean saturday i guess? |
11:31:20 | Yardanico | yeah :) |
11:31:45 | Yardanico | so basically from 08:00 to 13:30 (for 6 lessons) including breaks |
11:31:59 | dom96 | Okay, so you do get to go home early. |
11:32:23 | dom96 | For us it's 09:00 to 15:45 IIRC |
11:32:46 | dom96 | Funny how quickly I forgot the schedule :) |
11:33:17 | Yardanico | dom96, well in 9 and 11 school years we have additional lessons (preparation for state exams) |
11:33:42 | Yardanico | so it may actually be something like 08:00 to 14:20 |
11:34:21 | * | vendethiel- quit (Ping timeout: 240 seconds) |
11:34:33 | dom96 | That's interesting. |
11:34:46 | Yardanico | well it depends on the school and teachers |
11:35:07 | dom96 | sure |
11:35:15 | Yardanico | but private schools are not a common thing in russia |
11:35:25 | dom96 | But would you say the majority of Russian schools have classes on Saturdays? |
11:35:36 | Yardanico | dom96, yes, sure |
11:36:18 | FromGitter | <ephja> people will go along with anything for free vodka |
11:36:28 | Yardanico | :D |
11:36:49 | Yardanico | sadly they don't offer vodka at schools lol |
11:37:16 | FromGitter | <ephja> I see |
11:37:18 | Yardanico | (well not really sadly for me) |
11:37:37 | dom96 | I wonder if there is any people out there that attended many different schools all around the world. |
11:37:46 | dom96 | If there is and they wrote a book I would read it. |
11:38:12 | dom96 | In fact, you could probably write it by just getting a bunch of people from different countries |
11:38:26 | * | vendethiel- joined #nim |
11:38:34 | dom96 | But anyway, back on topic :) |
11:38:50 | dom96 | Yardanico: Interested in writing a bot to verify that issues on the Nim repo are still valid? |
11:38:58 | Yardanico | dom96, yeah I would try to do it |
11:39:21 | dom96 | Awesome. |
11:39:23 | Yardanico | It should be easy as long as nim code is written in proper markdown |
11:39:28 | FromGitter | <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:33 | dom96 | Yeah, I think you can make some assumptions |
11:39:45 | dom96 | Like force people to specify where the code is and where the expected output is |
11:39:55 | dom96 | We can enforce this for issues going forward |
11:40:24 | dom96 | And your bot can automatically check for this and berate people if they get it wrong as well :) |
11:40:37 | dom96 | Of course there will be a way to override this if an issue is too complex |
11:40:43 | FromGitter | <ephja> running with a debug build of the compiler makes it much easier to find duplicates |
11:42:00 | Yardanico | also one thing I find interesting about github is "every pull request is an issue, but not every issue is a pull request." |
11:42:15 | dom96 | yeah, that's a bit weird |
11:42:35 | dom96 | After 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:49 | dom96 | Going through issues is so addictive, it's like a game :) |
11:52:28 | Yardanico | yeah |
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:35 | Yardanico | dom96, well github api itself is very simple (for simple cases) |
12:10:39 | Yardanico | https://gist.github.com/Yardanico/d2cdecaa4e2b4fdcef36edd43ccf4bca |
12:10:50 | Yardanico | well I'm not getting all issues here |
12:10:56 | Yardanico | i want getIssues to return seq of issues |
12:12:47 | * | Arrrr quit (Ping timeout: 248 seconds) |
12:13:04 | dom96 | I think GitHub let's you subscribe to a sort of "issue stream" |
12:13:10 | dom96 | where you are able to get new issues |
12:13:15 | Yardanico | well I know |
12:13:16 | Yardanico | webhooks |
12:13:28 | Yardanico | https://developer.github.com/v3/activity/events/types/#issuesevent |
12:13:29 | dom96 | But I guess you want to look at older issues too |
12:13:34 | dom96 | I think that will be trickier |
12:14:15 | Yardanico | thanks 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:50 | Yardanico | dom96, better version of this stuff :) https://gist.github.com/Yardanico/f61a4f35df6488c1cff0d64268e860e3 |
12:29:02 | Yardanico | I've used strscans for parsing next page from "Link" header :P |
12:29:31 | Yardanico | (because I don't want a chain of ugly splits and it's actually needed for control flow) |
12:29:45 | dom96 | awesome! You're a scanf expert now |
12:29:48 | dom96 | I've never actually used it heh |
12:29:57 | Yardanico | well they're useful sometimes |
12:30:08 | Yardanico | because they're faster than splits and because of "if" :) |
12:30:25 | Yardanico | they're not like regexps |
12:31:12 | Yardanico | <$+>; rel=\"next" means that url will be a someUrl if string is <someUrl>; rel="next" |
12:31:50 | FromGitter | <krypton97> is there a graphql implementation in nim? |
12:32:00 | Yardanico | no :( |
12:32:16 | FromGitter | <krypton97> well, that's not nice |
12:32:28 | FromGitter | <krypton97> but porting the js library shoudn't be hard |
12:33:43 | dom96 | krypton97: Do it :D |
12:34:02 | Yardanico | Well it would be better to create "nim-style" graphql implementation |
12:34:10 | Yardanico | because of metaprogramming :) |
12:34:14 | FromGitter | <krypton97> yep |
12:36:04 | dom96 | yeah, you'll be able to parse the graphql at compile-time which will be awesome |
12:40:52 | * | orange33 joined #nim |
12:40:58 | couven92 | shr 2 is flooring division by 2, right? |
12:41:17 | orange33 | Anyone know how I can convert seq[byte] to a string? |
12:41:20 | couven92 | sry, shr 1, ie mean |
12:41:27 | Yardanico | orange33, yeah |
12:41:34 | Yardanico | one sec |
12:43:56 | Yardanico | orange33, well you can do it different ways |
12:44:24 | orange33 | Ok |
12:44:28 | Yardanico | one sec |
12:45:12 | miran | couven92: shr 1 == div 2 |
12:45:28 | couven92 | which is flooring? |
12:45:38 | miran | it is |
12:45:39 | Yardanico | orange33, if you want unsafe+fast approach - let yourString = cast[string](yourByteSeq) |
12:45:59 | couven92 | miran, thanks! I am never really sure of these things... :P |
12:45:59 | Yardanico | but i'm not sure how it works :D |
12:46:05 | Yardanico | can this leak memory? |
12:46:37 | miran | couven92: the best thing is to try it yourself with couple of examples. |
12:46:49 | dom96 | Yeah, don't do what Yardanico suggested |
12:46:59 | couven92 | miran, yeah, but I'll forget about in 5 minutes :P |
12:47:12 | Yardanico | dom96, well it's unsafe and fast (maybe he wants the fastest approach) |
12:47:39 | miran | couven92: well, `div` and `mod` shoud be easy to remember because those are "universal words" |
12:47:56 | couven92 | miran, it's more the flooring |
12:48:00 | dom96 | orange33: You can use foldl (or foldr?) for this |
12:48:02 | Yardanico | safe approach: |
12:48:08 | Yardanico | var yourStr = "" |
12:48:08 | orange33 | Yardanico: thanks! |
12:48:17 | Yardanico | orange33, wait a sec |
12:48:18 | orange33 | dom96: thanks ! |
12:48:23 | Yardanico | var yourStr = "" |
12:48:34 | Yardanico | for x in youByteSeq: yourStr.add chr(x) |
12:48:35 | dom96 | foldl(bytes, a & b, "") |
12:48:36 | miran | couven92: `shr` i forget if it is shr or rsh :) (unfortunately, you can't do plain and simple >>) |
12:48:40 | Yardanico | dom96, well yeah |
12:48:45 | dom96 | it's in the sequtils module |
12:48:53 | Yardanico | dom96, but it needs to import "sequtils" :) |
12:48:54 | * | dddddd joined #nim |
12:48:57 | dom96 | so? |
12:49:03 | orange33 | Ok cool I will have a look at that :) |
12:49:20 | dom96 | You don't get a penalty for importing modules |
12:49:23 | Yardanico | yeah I know |
12:49:36 | dom96 | ok, you were implying as if it was a bad thing :) |
12:49:51 | Yardanico | also, I'll ask Araq if cast[string](someSeqOfBytes) is unsafe (e.g. if it can leak memory), just curious |
12:49:58 | miran | btw, dom96 and Yardanico, is there any advantage of using `from module import function`? (other than readability) |
12:50:17 | Yardanico | miran, well you wouldn't able to use other functions from this module :P |
12:50:24 | Yardanico | let me check |
12:50:33 | orange33 | Thanks for the help Yardanico and dom96! :) |
12:50:44 | couven92 | miran, Nim is not Java! :P |
12:51:07 | dom96 | miran: just readability |
12:51:15 | Yardanico | well I just checked - only readability |
12:51:20 | Yardanico | C code would be the same |
12:51:26 | Yardanico | since Nim codegen knows how to remove dead code |
12:51:30 | Yardanico | (and C compiler knows it too) |
12:51:40 | dom96 | Yardanico: You would need to do: cast[string](bytes[0]) btw |
12:51:43 | dom96 | The [0] is important |
12:51:50 | couven92 | But sure, I'd use the `from m import p` only if need to avoid name collisions, right? |
12:51:51 | Yardanico | dom96, ah, to get an address? |
12:51:53 | miran | couven92: it is not java, it is python which compiles to C :D |
12:52:01 | Yardanico | couven92, yes |
12:52:21 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:52:23 | Yardanico | well you solve collisions by specifying full proc name including module |
12:52:28 | Yardanico | e.g. someModule.someProc() |
12:52:30 | dom96 | Yardanico: Sort of, it's because a seq is a struct { int len, array[...] items } |
12:52:46 | Yardanico | ah, ok |
12:52:49 | dom96 | You want to grab the first items, otherwise you get the 'len' |
12:53:08 | Yardanico | well I don't know how , but it worked :D |
12:53:29 | dom96 | You probably got "lucky" |
12:53:38 | dom96 | this is why 'cast' is dangerous |
12:53:54 | Yardanico | dom96, well yeah |
12:54:16 | Yardanico | dom96, 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:24 | dom96 | of course, because it's a literal |
12:56:30 | Yardanico | ah, yes |
12:57:52 | Yardanico | there'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:04 | FromGitter | <Grabli66> Hi. Is there a pragma do not compile if there are unused variables? I found none in documentation. |
13:14:07 | Yardanico | why you want this? |
13:14:26 | dom96 | Not that I know of, might be a good feature request. |
13:15:01 | FromGitter | <Grabli66> I want my code free from unused variables |
13:15:17 | dom96 | there might be an option that you can give the compiler though |
13:15:23 | Yardanico | well just see hints that compiler gives you ? :) |
13:15:59 | Yardanico | and if you use something like vscode it would underline them with green |
13:16:09 | Yardanico | (underline unused variables) |
13:16:15 | Yardanico | because it uses nim check |
13:16:35 | FromGitter | <Grabli66> I can not notice. |
13:17:59 | FromGitter | <Grabli66> But if my code will not compile. I'll notice that. |
13:19:17 | couven92 | Grabli66: file an issue https://github.com/nim-lang/Nim/issues/new |
13:19:23 | couven92 | It's a good idea |
13:19:49 | FromGitter | <Grabli66> Ok |
13:26:54 | Yardanico | Grabli66: but what's bad if something is not used from your code? |
13:27:05 | Yardanico | I can't really understand an usecase of this |
13:28:35 | dom96 | It's about keeping your code clean |
13:28:49 | dom96 | Code that is tidy is easier to read |
13:28:50 | FromGitter | <Grabli66> The aim is to clean code from garbage. |
13:29:00 | dom96 | Which 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:52 | couven92 | Is Araq here? |
13:44:18 | Yardanico | he's always *here* :) |
13:44:21 | Yardanico | I mean in IRC |
13:44:44 | couven92 | yeah... I need help with editDistance :P |
13:45:15 | Yardanico | couven92, let me guess. you've replaced everything but it still shows incorrect results? |
13:45:51 | couven92 | Yardanico, see for yourself: https://github.com/couven92/Nim/commit/c8a36647af899f54afa6274e4c47fd9c417d9cb3 |
13:47:01 | couven92 | calculating these upper triangles and lower triangles (whatever they are) is really hard when you have to take varying rune length into account... |
13:47:26 | couven92 | and now I have messed up somewhere these and get an infinte loop |
13:50:16 | couven92 | And 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:39 | FromGitter | <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:54 | dom96 | hello sysint64! |
14:00:02 | dom96 | https://github.com/nim-lang/nim/ |
14:00:10 | dom96 | Create an issue there |
14:00:23 | dom96 | Although it might be good to discuss it here first |
14:00:37 | dom96 | What does this 'with' do? |
14:01:52 | FromGitter | <sysint64> I put examples in D since I just began using nim. there is example without operator with |
14:02:13 | FromGitter | <sysint64> obj.a = 10; ⏎ obj.b = 12; ⏎ obj.c = "Hello"; |
14:02:47 | FromGitter | <sysint64> with operator `with`: ⏎ with (obj) { ⏎ ⏎ ```a = 10 ⏎ b = 12 ⏎ c = "Hello"``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=59aaba07bc46472974ebac1f] |
14:02:56 | FromGitter | <sysint64> sometimes it's very usefull |
14:03:27 | miran | i can't tell from the example, is it a context manager, like `with` in python? |
14:05:05 | Yardanico | well you can probably do this with a macro :) |
14:06:04 | FromGitter | <sysint64> @miran no it's just reduce code repetition in this particular case - it constant repetition of `obj` |
14:06:10 | federico3 | or just a template |
14:06:13 | dom96 | oh, this already exists in Nim |
14:06:23 | Yardanico | oh bad |
14:06:27 | Yardanico | it's a reserved keyword |
14:06:34 | Yardanico | but not actually implemented :) |
14:07:03 | Yardanico | I can make a mcro with name "toWith" |
14:07:11 | dom96 | Firstly, there is this related thing: https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement |
14:07:36 | Yardanico | well it's not the exact same thing |
14:07:47 | Yardanico | there's also {.this: self.} but it's specific to procedures |
14:08:54 | Yardanico | federico3, hmm, I can't really implement this with a template :) |
14:08:56 | dom96 | Yeah, {.this.} is what I was thinking of |
14:09:34 | Yardanico | hmm let me try it without any procs |
14:09:36 | Yardanico | maybe it works |
14:09:47 | dom96 | Some examples here https://forum.nim-lang.org/t/2454 |
14:09:53 | * | mahmudov joined #nim |
14:10:20 | Yardanico | yeah it works |
14:12:03 | Yardanico | but not always though |
14:12:55 | Yardanico | https://gist.github.com/Yardanico/36a21ae9abd235ef75b73a890f1b5029 |
14:13:11 | Yardanico | I've put it into a block to actually mimic "with" scope |
14:13:19 | Yardanico | you can use {.this.} pragma without blocks |
14:14:29 | Yardanico | but 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:39 | Yardanico | *name your object |
14:14:59 | FromGitter | <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:16 | FromGitter | <Yardanico> let me try :) |
14:16:31 | Yardanico | oh wait |
14:16:37 | Yardanico | it seems this doesn't work hmm |
14:16:47 | Yardanico | I mean "{.this: self.}" |
14:17:06 | Yardanico | I'll write a macro instead :P |
14:17:20 | Yardanico | don't leave yet |
14:18:30 | FromGitter | <sysint64> ok :) |
14:22:07 | FromGitter | <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:18 | FromGitter | <sysint64> and at the same time there is everything that I like so much about D |
14:24:08 | * | pilne joined #nim |
14:25:37 | dom96 | That's great to hear :D |
14:25:54 | FromGitter | <sysint64> and now I can't make a choice: D or NIM, both steep |
14:27:10 | dom96 | We're going to be pretty biased here and suggest Nim :) |
14:27:30 | dom96 | But out of curiosity, what software are you planning to write? |
14:27:37 | dom96 | that might help with the decision |
14:29:27 | dom96 | Yay https://github.com/nim-lang/Nim/commit/90fa64501f0eba487182a760fde98f7bb955c3d7 :) |
14:29:38 | Yardanico | dom96, what's this? |
14:29:57 | dom96 | Support for this feature https://github.com/nim-lang/nimble#nimble-develop |
14:29:57 | FromGitter | <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:51 | Yardanico | you'll understand the power of metaprogramming when I will make a simple "toWith" macro (without additional checks, but working) :) |
14:31:35 | dom96 | Nim is perfect for games :) |
14:34:53 | Yardanico | yeah I did it |
14:35:48 | FromGitter | <sysint64> another feature that I like in D is UDA (user defined attributes) - https://dlang.org/spec/attribute.html#uda |
14:36:03 | Yardanico | yeah you can do that |
14:36:06 | Yardanico | in nim it would be a pragma |
14:37:44 | FromGitter | <sysint64> with this I'm writing simple UI framework in D there is example of usage: ⏎ https://gist.github.com/sysint64/135c5c60e47ebd4f77bd88a15bdbbac1 |
14:38:16 | Yardanico | in python they're called "decorators" btw |
14:38:20 | Yardanico | same in java iirc |
14:38:36 | FromGitter | <sysint64> decorators it's not the same as attributes |
14:39:44 | FromGitter | <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:08 | Yardanico | well yeah, probably nim pragmas allows you do the same |
14:41:56 | dom96 | yep, you can have {.ViewWidget: "cancelButton".} |
14:41:57 | dom96 | in Nim |
14:42:32 | FromGitter | <sysint64> that's great ) |
14:50:32 | dom96 | Nim in Action is 50% off today as well https://twitter.com/d0m96/status/903993461711523840 :) |
14:50:44 | dom96 | You can get the pBook half off today as well |
14:56:59 | FromGitter | <sysint64> Nim in Action - is a good book? |
14:58:02 | dom96 | From what i've heard it is :) |
15:00:20 | miran | :D |
15:04:12 | FromGitter | <sysint64> how difficult is it to write DSL on nim? are there any examples? |
15:06:48 | * | Matthias247 joined #nim |
15:07:39 | dom96 | Here is an example from the book https://github.com/dom96/nim-in-action-code/blob/master/Chapter9/configurator/configurator.nim |
15:07:51 | dom96 | I'd say the difficulty is average |
15:08:56 | Yardanico | dom96, btw, you could've used templates or quote do |
15:09:36 | dom96 | hrm? i did |
15:15:12 | * | BigEpsilon quit (Ping timeout: 252 seconds) |
15:32:52 | FromGitter | <Yardanico> @sysint64 sorry for the delay |
15:32:54 | FromGitter | <Yardanico> here you go - https://gist.github.com/Yardanico/0318e54afe7527ab1e74b101c24bd78e |
15:33:01 | Yardanico | this is "toWith" macro |
15:34:04 | FromGitter | <Yardanico> @sysint64 btw, there is Xored Inc in your city :) |
15:34:15 | FromGitter | <Yardanico> they support Nim a lot and create useful stuff for it |
15:36:12 | Yardanico | I love macros :3 |
15:36:23 | FromGitter | <sysint64> @Yardanico awesome! thanks :) |
15:36:41 | FromGitter | <Yardanico> @sysint64 you can also PM me on gitter if you want to ask something in russian :) |
15:37:38 | FromGitter | <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:37 | FromGitter | <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:56 | Yardanico | yes |
16:20:59 | Yardanico | "streams" |
16:21:05 | Yardanico | https://nim-lang.org/docs/streams.html |
16:21:43 | Yardanico | you can read/write chars, bools, int8, int16, int32, int64, float32, float64, string, line |
16:22:12 | FromGitter | <Grabli66> Thanks. Now i see. |
16:25:18 | FromGitter | <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:58 | def-pri-pub | zacharycarter: 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:10 | def-pri-pub | I 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:04 | def-pri-pub | So I have my `Sprite` object which is a `object of RootObj` type, and my `SpriteBatch` object which is the rendering queue |
17:45:34 | def-pri-pub | inside of `Spritebatch`, there is a `seq[Sprite]` which is the underlying queue |
17:45:52 | def-pri-pub | I'm wondering if it would be more efficient to switch that out to a `seq[Sprite ptr]` instead |
17:46:38 | def-pri-pub | While 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:17 | def-pri-pub | As 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:42 | def-pri-pub | Also, 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:10 | Yardanico | maybe you can use {.shallow.} pragma to remove copying? |
18:03:15 | Yardanico | or shallowCopy somehow |
18:05:02 | FromGitter | <Grabli66> Yes. In documentation i saw to use shallow proc on string to prevent string copy. |
18:10:26 | dom96 | I don't think 'add' copies |
18:12:08 | dom96 | Indeed, it's easily testable and I am correct: https://gist.github.com/dom96/7f5d7a151c6c116988b9ddb926eb281c |
18:12:38 | dom96 | def-pri-pub: Are you actually seeing any performance problems right now? |
18:16:16 | def-pri-pub | No |
18:16:26 | def-pri-pub | I'm just trying rice it now :] |
18:16:42 | def-pri-pub | (thinking for the future) |
18:27:39 | * | def-pri-pub quit (Ping timeout: 240 seconds) |
18:35:43 | Yardanico | wow |
18:36:14 | Yardanico | TIL that ReactOS (free open-source windows-compatible OS) has 14 millions of unit test cases! |
18:36:24 | Yardanico | 14 MILLIONS |
18:38:08 | Yardanico | that's a nightmare |
18:39:27 | FromGitter | <Grabli66> Is it possible to use nim in reactos? :) |
18:39:29 | * | rauss quit (Read error: Connection reset by peer) |
18:40:00 | Yardanico | should be |
18:40:10 | Yardanico | since you can run nimgw on reactos |
18:40:21 | Yardanico | but IIRC ReactOS has unstable command-line |
18:40:32 | Yardanico | I mean that cmd.exe command parsers is bad |
18:41:12 | FromGitter | <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:23 | Yardanico | well consider how much developers Microsoft have |
18:41:36 | Yardanico | and consider that ReactOS isn't supported by big corporations.. |
18:41:37 | Yardanico | like nim |
18:41:48 | Yardanico | but it can already run a whole lot of apps |
18:42:03 | Yardanico | yeah, real hardware is a problem now, but it's becoming only better and better |
18:42:15 | Yardanico | in 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:42 | Yardanico | dom96, quick PoC: (only downloads 30 issues): https://gist.github.com/Yardanico/aa0496653fc687524b3ef014655ffc49 |
18:53:31 | Yardanico | it 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:45 | Yardanico | comprun.log contains compiler output |
18:53:57 | dom96 | cool |
18:54:06 | dom96 | Nice job :) |
18:54:15 | Yardanico | well nothing fancy here |
18:54:21 | Yardanico | also I don't need auth for this |
18:55:17 | dom96 | We should create an issue template: https://github.com/blog/2111-issue-and-pull-request-templates |
18:55:50 | Yardanico | maybe we should firstly see some examples in another repos :) |
18:55:55 | Yardanico | btw rust and crystal don't have these |
18:56:05 | dom96 | I've never seen any other project do this |
18:56:09 | dom96 | But I think it's a great idea |
18:57:11 | dom96 | The hard part is creating a template that isn't too much of a burden |
18:57:20 | dom96 | And one that is flexible enough to support most issue types |
18:57:22 | Yardanico | yeah |
18:57:33 | dom96 | But if you're up for it then please create a PR with one :) |
18:57:37 | * | PMunch joined #nim |
18:58:50 | Yardanico | lol, 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:17 | dom96 | :) |
18:59:48 | dom96 | btw I added a readme to Nim's tests directory: https://github.com/nim-lang/Nim/tree/devel/tests#readme |
19:00:00 | FromGitter | <xmonader> Shouldn't pragma raises propagate to caller methods? |
19:00:09 | Yardanico | it does |
19:00:12 | Yardanico | ah |
19:00:39 | FromGitter | <xmonader> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59aaffd766c1c7c4770b1b52] |
19:01:01 | FromGitter | <xmonader> apparently .get request doesn't have raises pargma |
19:01:22 | Yardanico | ehm, and how do you for compiler to add it? |
19:01:26 | Yardanico | edit .nim file? :D |
19:01:57 | dom96 | xmonader: your code sample doesn't either? |
19:02:05 | Yardanico | ah wait |
19:02:10 | Yardanico | your code wouldn't have any raises pragma |
19:02:20 | Yardanico | because it "try" "except" every possible exeption |
19:02:22 | Yardanico | exception |
19:02:31 | FromGitter | <xmonader> I don't expect the compiler to allow it the .get call without handling it |
19:02:46 | FromGitter | <xmonader> The get procedure definition doesn't have "pragma raises" |
19:03:01 | * | Nobabs27 joined #nim |
19:03:07 | Yardanico | well Nim allows exception to be thrown |
19:03:13 | Yardanico | you're not forced to catch all exceptions |
19:03:55 | FromGitter | <xmonader> Aha, What about adding raises pragma in the get method defintion? |
19:04:10 | Yardanico | xmonader: try this https://gist.github.com/Yardanico/b2ff6645a67aad7b3d77bad777c98601 |
19:04:12 | FromGitter | <xmonader> @Yardanico That's the problem I didn't see raises so I expected it'll always be OK |
19:04:26 | Yardanico | you're not forced to specify {.raises.} |
19:04:34 | Yardanico | compiler does it automatically |
19:04:57 | FromGitter | <xmonader> But How can I write code without knowing specific parts may raise an exception? |
19:05:14 | Yardanico | and after that snippet try this: https://gist.github.com/Yardanico/d2aba602c306910bd188d6f3c90d28ba |
19:05:17 | Yardanico | as usual lol |
19:05:25 | Yardanico | my second gist would work |
19:05:33 | Yardanico | because you've wrapped everything in try/except |
19:05:39 | Yardanico | and first wouldn't |
19:05:56 | Yardanico | xmonader: Nim has exceptions, and they can be thrown |
19:06:05 | Yardanico | java/python have exceptions too |
19:06:20 | Yardanico | js/c++/etc |
19:06:39 | FromGitter | <xmonader> @Yardanico :) ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ab013f8f4427b462c6e26f] |
19:07:05 | FromGitter | <Yardanico> and? I know that it doesn't have raises pragma because it doesn't need to do it |
19:07:08 | dom96 | the compiler infers what exceptions are raised. |
19:07:30 | dom96 | https://nim-lang.org/docs/httpclient.html#get,AsyncHttpClient,string |
19:07:34 | dom96 | Click the `{..}` |
19:07:37 | FromGitter | <Yardanico> https://nim-lang.org/docs/tut2.html#exceptions-annotating-procs-with-raised-exceptions |
19:07:49 | dom96 | (That really needs a style that gives it an underline) |
19:08:01 | FromGitter | <Yardanico> also you can add pragma {.effects.} to your proc |
19:08:07 | FromGitter | <Yardanico> and compiler will print all effects of this proc |
19:08:12 | mahmudov | zmq lib is on usage ? |
19:08:13 | FromGitter | <Yardanico> including possible exceptions |
19:08:34 | mahmudov | i cant communicate python-cli and nim-server via zeromq |
19:08:43 | FromGitter | <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:54 | Yardanico | why it should give hints? |
19:08:57 | Yardanico | and btw it can do it |
19:09:03 | Yardanico | add {.effects.} pragma to your proc |
19:09:15 | Yardanico | oh |
19:10:01 | Yardanico | ah |
19:10:06 | Yardanico | Add {.effects.} to the end of your proc |
19:10:13 | Yardanico | and compiler will show all effects/exceptions |
19:10:29 | Yardanico | I don't really know WHY you need IDE to specify that exceptions can be thrown |
19:10:56 | Yardanico | I mean why do you need this? even pycharm ide (biggest ide for python) doesn't have that |
19:11:07 | dom96 | xmonader: are you coming from Java? |
19:11:43 | FromGitter | <xmonader> @dom96 I'm mainly a pythonista, but yes, I used java in the past. |
19:12:01 | Yardanico | well do you handle all possible exceptions in python? :D |
19:12:06 | FromGitter | <xmonader> @Yardanico Nim is a static language, the type system should help me write code |
19:12:25 | Yardanico | ehm, I still don't get it |
19:12:46 | Yardanico | how can possible exceptions help you with writing code? |
19:12:55 | Yardanico | also maybe Araq can explain it better |
19:13:04 | Yardanico | I don't use "raises" at all, and yes, I came from python |
19:13:09 | dom96 | Nim's checked exceptions are opt-in |
19:13:16 | dom96 | Unlike Java's |
19:13:22 | dom96 | Java forces you to handle them everywhere |
19:13:58 | FromGitter | <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:15 | FromGitter | <xmonader> @dom96 Uha, Thank you :) |
19:14:23 | Yardanico | add {.effects.} to the end of your proc |
19:14:24 | dom96 | You just need to ask it to do that by annotating your proc with {.raises: [].} |
19:14:31 | Yardanico | dom96, this would be too hard |
19:14:41 | dom96 | Yardanico: how so? |
19:14:44 | Yardanico | compile-see one exception - add it to raises or handle it - compile again |
19:14:47 | Yardanico | better to use {.effects.} |
19:15:36 | Yardanico | effects would print all possible exceptions, and places where these exceptions can be thrown raised |
19:15:38 | Yardanico | example |
19:15:41 | * | yglukhov joined #nim |
19:15:42 | Yardanico | lib/pure/httpclient.nim(1104, 9) Hint: ref HttpRequestError [User] |
19:15:57 | Yardanico | and this for every possible exception/effect |
19:17:09 | * | def-pri-pub quit (Ping timeout: 240 seconds) |
19:17:26 | Yardanico | xmonader: Nim already does a lot of compile-time checking |
19:17:50 | FromGitter | <xmonader> @Yardanico I see {.effects.} pragama is amazing. Didn't know it exists in the first place |
19:17:59 | FromGitter | <xmonader> Thank you all :) |
19:17:59 | Yardanico | read manual :) |
19:18:19 | FromGitter | <xmonader> I read lots of it, maybe I skipped/assumed some parts. |
19:18:57 | Yardanico | also btw I've never used effects before, and I'm amazed that it prints line numbers |
19:19:01 | Yardanico | where 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:23 | dom96 | cool :) |
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:07 | FromGitter | <ephja> it's the future! |
19:48:33 | def-pri-pub | zacharycarter: 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:38 | FromGitter | <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:08 | FromGitter | <adamrezich> is there a way to unpack tuples and declare the variables that you're unpacking them into in one line? |
20:02:14 | FromGitter | <adamrezich> nevermind i'm a moron |
20:02:35 | FromGitter | <adamrezich> (still though I don't think I saw it in the manual) |
20:03:33 | FromGitter | <adamrezich> nevermind, now I see it -__- |
20:03:36 | Yardanico | well it's not as nice as in python, but you can still do it |
20:03:37 | Yardanico | also |
20:03:50 | Yardanico | if you want to unpack a seq - you can use simple macro |
20:03:53 | Yardanico | one sec :) |
20:05:04 | Yardanico | adamrezich: https://gist.github.com/Yardanico/3ed3f8d8b6ccd070afd67e8bd26f2914 |
20:05:28 | Yardanico | but it would fail with index out of bounds error if you have incorrect number of arguments in extract |
20:05:37 | FromGitter | <adamrezich> oh that's pretty neat |
20:05:48 | Yardanico | oh waitr |
20:05:51 | Yardanico | not "extract" |
20:05:52 | Yardanico | unpack |
20:06:30 | Yardanico | ah, you're probably using 0.17.0 |
20:06:33 | Yardanico | this would fail for you |
20:06:34 | Yardanico | one sec :) |
20:06:58 | Yardanico | https://play.nim-lang.org/?gist=335eb72a3a9d11a497ed0a5e662411de |
20:07:34 | FromGitter | <xmonader> apparently I can't use tuples in FlowVars, only ref objects are allowed. |
20:07:47 | Yardanico | xmonader: why you don't use async? |
20:07:53 | Yardanico | it's better for IO |
20:08:07 | FromGitter | <xmonader> @Yardanico it's the upcoming one. |
20:08:26 | Yardanico | well "spawn" is thread-based |
20:08:31 | Yardanico | async is coroutine-based |
20:08:51 | FromGitter | <xmonader> Also, I want to use channel with spawns |
20:09:18 | FromGitter | <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:32 | FromGitter | <adamrezich> @Yardanico nice, I'll keep that in mind for future use :) |
20:12:03 | Yardanico | well you can do almost everything with macros |
20:12:10 | Yardanico | as long as it's a valid nim syntax |
20:12:30 | Yardanico | well 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:15 | ehmry | with 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:15 | Yardanico | EastByte, I guess so |
20:33:22 | * | ipjk_ quit (Ping timeout: 264 seconds) |
20:33:31 | PMunch | Well probably not an arbitrary one, but the one with the least use at the moment |
20:33:38 | Yardanico | nim threads are os threads AFAIK |
20:33:49 | PMunch | Think so yeah |
20:34:38 | Yardanico | dom96, btw, about issue template: I'm thinking of something like *special* comments in code snippets |
20:34:46 | Yardanico | so like: |
20:34:53 | Yardanico | # filename a.nim |
20:34:58 | ehmry | ok, cook |
20:35:02 | ehmry | *cool |
20:35:04 | Yardanico | # compile nim c --threads:on -r a.nim |
20:35:37 | * | ipjk joined #nim |
20:37:02 | Yardanico | also maybe |
20:37:33 | Yardanico | # packages strfmt |
20:37:36 | Yardanico | for nimble packages |
20:37:36 | mahmudov | Araq 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:52 | dom96 | Yardanico: maybe you could reuse testament's spec parser? :) |
20:40:18 | FromGitter | <xmonader> Quick question: I can't call await on asyncResponse? Only on flowvars? |
20:40:19 | Yardanico | dom96, well I think it would be a bit too verbose |
20:40:38 | dom96 | why? |
20:40:38 | Yardanico | xmonader: AsyncResponse from httpclient? |
20:40:41 | Yardanico | you can |
20:40:46 | FromGitter | <xmonader> yes |
20:40:48 | Araq | mahmudov: fix it |
20:40:52 | Yardanico | asyncdispatch module |
20:41:08 | dom96 | xmonader: you can but only in an async proc |
20:41:47 | FromGitter | <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:01 | Yardanico | you sure can |
20:42:01 | Yardanico | yes |
20:42:05 | Yardanico | or maybe no |
20:42:12 | Yardanico | nim probably can figure out this by himself |
20:42:36 | Yardanico | because awaits from asyncdispatch and threadpool have different arguments |
20:43:09 | FromGitter | <xmonader> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ab17dd162adb6d2e5f458b] |
20:43:22 | Yardanico | did you import asyncdispatch? |
20:43:27 | FromGitter | <xmonader> yes |
20:43:36 | Yardanico | ah |
20:43:40 | Yardanico | your proc should be async as dom96 said |
20:43:43 | Yardanico | {.async.} pragma |
20:45:48 | FromGitter | <xmonader> |
20:46:43 | * | vivus joined #nim |
20:48:37 | Yardanico | dom96, yeah, testament parsing code looks clean |
20:48:46 | Yardanico | also good thing that it's not dependent on compiler |
20:48:52 | Yardanico | only on stdlib |
20:49:19 | dom96 | in fact, why don't you just save the code from the issue and use testament to test it :) |
20:49:45 | Yardanico | well I think users would be lazy to provide correct testament config |
20:50:02 | Yardanico | e.g. typing all these "line", "column" |
20:50:10 | dom96 | hrm? |
20:50:16 | dom96 | don't know what those are |
20:50:19 | dom96 | never had to use them |
20:50:44 | Yardanico | https://github.com/nim-lang/Nim/blob/2aa31869b6c7b97408c93d2553531cbe02bab376/tests/parser/twrongcmdsyntax.nim |
20:50:47 | dom96 | an additional advantage that this brings is that we can just copy the code and add it as a test case |
20:50:52 | Yardanico | well yeah |
20:50:58 | Yardanico | that's that I was thinking about |
20:51:02 | dom96 | pretty sure that's optional |
20:51:12 | Yardanico | well yeah |
20:51:19 | Yardanico | but it would help in some issues |
20:51:26 | Yardanico | there are issues with incorrect error messages :) |
20:51:36 | Yardanico | *with incorrect line numbers |
20:51:39 | Yardanico | in error messages |
20:51:41 | dom96 | okay, well some users will be lazy yes |
20:51:46 | dom96 | You can't do anything about that |
20:51:54 | dom96 | and it's not a reason to not use testament |
20:52:16 | Yardanico | I'll see if I can use testament separately from compiler |
20:52:26 | Yardanico | hmm probably I can |
20:52:34 | Yardanico | it only imports one thing from the compiler |
20:52:36 | Yardanico | "compiler/nodejs" |
20:52:47 | * | yglukhov quit (Remote host closed the connection) |
20:55:06 | dom96 | Like I said, just use testament directly |
20:55:19 | dom96 | Save the code in tfile.nim |
20:55:28 | Yardanico | yeah |
20:55:34 | dom96 | put it in some new directory under $nim/tests/ |
20:55:43 | dom96 | then run ./koch tests cat <new_dir_name> |
20:56:21 | * | Elronnd joined #nim |
20:59:48 | Yardanico | thanks to Parashurama we can now run pure nim bigints at compile-time! yay https://github.com/nim-lang/Nim/pull/6224 |
20:59:56 | Yardanico | I've tested and it WORKS! |
21:09:31 | * | PMunch quit (Quit: leaving) |
21:10:01 | def- | Yardanico: very cool |
21:13:29 | * | yglukhov joined #nim |
21:14:48 | Yardanico | def-, also I'm amazed about this |
21:14:51 | Yardanico | "We're about twice as slow as GMP in these microbenchmarks" |
21:14:57 | Yardanico | your bigints doesn't even contain a line of C code |
21:15:12 | def- | it's not about using C code |
21:15:17 | Yardanico | and it's only 2x slower than mega-optimized GMP version |
21:15:30 | Yardanico | maybe GMP uses some SSE like things? |
21:15:43 | def- | It's about GMP having many years of optimizations, vectorization, etc |
21:15:44 | def- | yeah |
21:16:00 | Yardanico | also can I divide one bigint by another? |
21:16:22 | def- | yes |
21:16:42 | Yardanico | def-, how ? :P |
21:16:50 | Yardanico | there's no `/` proc |
21:16:54 | def- | `div` |
21:17:01 | Yardanico | ah, ok |
21:17:04 | def- | a div b |
21:17:29 | def- | is for float division in Nim |
21:17:34 | def- | / |
21:17:44 | Yardanico | ah |
21:20:19 | * | Yardanico quit (Remote host closed the connection) |
21:21:35 | * | xet7 quit (Ping timeout: 248 seconds) |
21:22:19 | dom96 | hey def-. What are you working on these days? :) |
21:22:27 | def- | hi dom96 |
21:22:44 | def- | work, DDNet, nothing new |
21:25:01 | dom96 | Ahh :) |
21:25:32 | def- | congrats on the book release, dom96 |
21:25:50 | dom96 | thanks, did you get a copy? |
21:26:12 | def- | nope |
21:26:32 | * | skrylar joined #nim |
21:26:35 | def- | You gave me access to the digital version though |
21:26:40 | dom96 | It'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:31 | FromGitter | <xmonader> linkchecker.nim(49, 88) template/generic instantiation from here ⏎ lib/pure/asyncmacro.nim(19, 10) Error: index out of bounds |
21:49:43 | FromGitter | <xmonader> `````` |
21:55:15 | FromGitter | <Yardanico> You need to show us whole proc code sadly |
21:55:35 | FromGitter | <Yardanico> Do you use await in a try block? |
21:55:51 | FromGitter | <xmonader> yes -_- |
21:56:22 | FromGitter | <xmonader> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ab2906bac826f05473bdbd] |
21:56:31 | FromGitter | <Yardanico> You can't do that |
21:56:45 | FromGitter | <Yardanico> Check asyncdispatch focs |
21:56:47 | FromGitter | <Yardanico> Docs |
21:56:52 | * | skrylar cringes. |
21:57:01 | FromGitter | <xmonader> What's the idiomatic way? |
21:57:10 | FromGitter | <Yardanico> There's info about how to handle future errors |
21:57:32 | FromGitter | <Yardanico> https://nim-lang.org/docs/asyncdispatch.html#ans |
21:57:34 | FromGitter | <Yardanico> synchronous-procedures-handling-excepti |
21:57:37 | * | Sentreen joined #nim |
21:57:39 | FromGitter | <Yardanico> Sorry |
21:57:41 | FromGitter | <Yardanico> https://nim-lang.org/docs/asyncdispatch.html#asynchronous-procedures-handling-exceptions |
21:57:54 | FromGitter | <xmonader> Thank you I'll check |
22:02:41 | * | dom96 is impressed that this is documented |
22:08:36 | skrylar | it sounds like async is cancer |
22:10:23 | dom96 | Wow, that's a bit dramatic. |
22:10:56 | skrylar | i dunno, every time someone asks about it there's some serious issue or another |
22:11:19 | skrylar | starting to wonder if it actually works or one might as well just use a work queue |
22:11:25 | FromGitter | <Yardanico> Well it's not easy to create async/await with s macro :) |
22:11:29 | FromGitter | <Yardanico> Yeah it works |
22:12:11 | FromGitter | <Yardanico> One thing that I've noticed - most of compiler/some stdlib modules don't have comments (only a few) |
22:12:28 | FromGitter | <Yardanico> I mean in their source |
22:12:52 | * | yglukhov quit (Remote host closed the connection) |
22:13:29 | FromGitter | <Yardanico> And I can't think how I would use work queue for my async app :) |
22:13:35 | dom96 | skrylar: Of course it works. The forum and NimBot both run on it. |
22:13:56 | dom96 | !ping |
22:13:56 | NimBot | pong |
22:13:56 | FromGitter | <Yardanico> !ping |
22:14:00 | dom96 | !lag |
22:14:00 | NimBot | 30ms between me and the server. |
22:14:05 | FromGitter | <Yardanico> Hah |
22:14:16 | FromGitter | <Yardanico> We're sent !ping at the same time |
22:14:17 | dom96 | Won't work through gitter :) |
22:14:22 | FromGitter | <Yardanico> Yeah |
22:14:50 | * | Yardanico joined #nim |
22:15:08 | Yardanico | !lag |
22:15:08 | NimBot | 29ms between me and the server. |
22:15:39 | skrylar | Yardanico: i get to finally deal with multi-core processing in nim the next time i do any AI work :\ |
22:15:54 | skrylar | implementing A3C after this one layer of neurons is fixed |
22:16:08 | FromGitter | <Yardanico> Well async is not about multi threading and calculations |
22:16:19 | FromGitter | <Yardanico> It's about IO mostly |
22:16:36 | skrylar | this current generation of AI terrifies me |
22:16:44 | skrylar | and is somewhat depressing |
22:17:02 | skrylar | i think the paper said A3C became a master pong player in 30 minutes |
22:18:10 | dom96 | Huh, it terrifies you as in you're afraid that the storyline of Terminator will happen? |
22:18:44 | skrylar | Its 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:48 | skrylar | I mean these things NEVER sleep |
22:19:44 | skrylar | the 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:42 | FromGitter | <Yardanico> Well it uses special framework for bots? Or it only gets image of display as input?! |
22:20:56 | skrylar | on pong its pixel input |
22:21:05 | FromGitter | <xmonader> if I do yield future is it equivalent to await future? |
22:21:15 | FromGitter | <Yardanico> No |
22:21:22 | FromGitter | <xmonader> if so how can i retrieve the success value? |
22:21:31 | FromGitter | <Yardanico> future.read() |
22:21:40 | FromGitter | <Yardanico> after you've yielded it |
22:21:49 | FromGitter | <xmonader> but I can't do await after the yield correct? |
22:21:59 | skrylar | i'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:08 | FromGitter | <Yardanico> Yes, you can't, why do you need it? |
22:22:41 | FromGitter | <Yardanico> By yield you're executing a future |
22:22:50 | skrylar | https://arxiv.org/abs/1708.05344 |
22:22:51 | dom96 | skrylar: I wasn't impressed by the Dota 2 AI at all. |
22:23:12 | dom96 | And people beat it very quickly |
22:23:31 | dom96 | I'll be impressed if they manage to win a 5v5 |
22:23:41 | dom96 | without any restrictions |
22:23:52 | skrylar | Uh, not Valve's AI |
22:23:56 | skrylar | OpenAI did it. Beat a master. |
22:23:57 | dom96 | I know |
22:25:03 | FromGitter | <Yardanico> A bit offtopic: I've learned most |
22:25:13 | dom96 | From what i've read about it, others weren't impressed either. |
22:25:31 | skrylar | that's not what i read /shrug |
22:26:25 | dom96 | https://news.ycombinator.com/item?id=14995832 |
22:26:40 | skrylar | Well, 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:02 | skrylar | I 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:24 | skrylar | But there's a lot more compute requirements to generate multiple seed AIs and make those fight each other |
22:28:25 | FromGitter | <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:39 | FromGitter | <Yardanico> Eh |
22:28:44 | skrylar | each network is its own weird beast. |
22:28:47 | FromGitter | <Yardanico> Gitter on mobile sucks |
22:28:51 | skrylar | gitter sucks :> |
22:28:57 | FromGitter | <Yardanico> Going to irc |
22:29:14 | skrylar | sometimes you roll a random set of weights and it converges super fast, some generate and are functionally retarded |
22:29:16 | skrylar | life is weird |
22:31:56 | FromGitter | <xmonader> ```code paste, see link``` ⏎ ⏎ this code freezes :S [https://gitter.im/nim-lang/Nim?at=59ab315cba0f0f6e380e883f] |
22:31:56 | Yardanico | so 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:27 | skrylar | you're supposed to learn them by playing sierra adventure games :^) |
22:33:35 | FromGitter | <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:59 | Yardanico | skrylar: yeah, games too |
22:34:06 | FromGitter | <xmonader> @Yardanico It's okay :( |
22:35:21 | * | miran quit (Ping timeout: 240 seconds) |
22:35:45 | Yardanico | btw in Russia in most of the schools students have English as a foreign language |
22:36:13 | Yardanico | me too |
22:36:53 | Yardanico | but this doesn't really makes much sense for me:) |
22:37:51 | skrylar | i tried learning other human languages |
22:39:12 | dom96 | xmonader: can you gist the full code? |
22:39:19 | Yardanico | and it didn't go well? :) |
22:40:38 | FromGitter | <xmonader> @dom96 https://gist.github.com/xmonader/e14e3234157b727d63f2d7eb8955b0a2 |
22:41:20 | FromGitter | <xmonader> problem is with asyncLinksChecker/checkLinkAsync it never ends |
22:41:29 | skrylar | Yardanico, you really have to have a need for them |
22:41:40 | FromGitter | <xmonader> well, it gave me once the time but then it stopped for good |
22:41:43 | Yardanico | oh wait xmobader |
22:41:59 | Yardanico | how are you calling this proc? |
22:42:31 | Yardanico | are you using runForever() maybe? |
22:43:20 | FromGitter | <xmonader> @Yardanico nope just regular call |
22:43:40 | dom96 | that doesn't compile for me |
22:43:46 | FromGitter | <xmonader> I'm folllowing this https://github.com/nim-lang/Nim/blob/devel/tests/async/tasyncall.nim#L47 |
22:43:52 | dom96 | a4.nim(50, 22) Error: type mismatch: got (Future[Future[a4.result]], result) |
22:44:08 | FromGitter | <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:00 | FromGitter | <xmonader> @dom96 nim c -r --threads:on -d:ssl |
22:45:04 | Yardanico | xmonader: 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:44 | Yardanico | use "waitFor myProc()" if you want to block current thread until this proc finishes |
22:46:00 | dom96 | interesting. |
22:46:03 | dom96 | Compiles in 0.17.0 |
22:46:05 | dom96 | but not in devel |
22:46:09 | Yardanico | or asyncCheck myProc() if you don't want to block it |
22:46:09 | FromGitter | <xmonader> @Yardanico but i use waitFor already in the other process |
22:46:29 | Yardanico | dom96: probably because of result? |
22:46:39 | dom96 | yeah, I wouldn't be surprised |
22:46:51 | dom96 | Naming your type `result` is a bad idea |
22:47:05 | FromGitter | <xmonader> is it because it's the same as pascal's return name? |
22:47:13 | FromGitter | <xmonader> sorry nim's** |
22:47:27 | Yardanico | probably it is |
22:47:32 | Yardanico | and btw |
22:47:38 | dom96 | yeah, that is the reason |
22:47:43 | dom96 | And the error is just weird in devel |
22:47:44 | Yardanico | you don't need to use void return type |
22:47:47 | dom96 | works in 0.17.0 |
22:48:00 | dom96 | yes |
22:48:05 | Yardanico | its optional |
22:48:08 | dom96 | `result` is implicitly defined |
22:50:26 | dom96 | also it works fine on my machine |
22:50:32 | dom96 | after I rename the type to Result |
22:51:32 | dom96 | but the fact that this compiles is surprising |
22:51:45 | dom96 | You've got |
22:51:46 | dom96 | proc checkLinkAsync(link: string, client:AsyncHttpClient): Future[Result] |
22:51:56 | dom96 | proc checkLink(link: string, client:HttpClient | AsyncHttpClient) : Result |
22:52:13 | dom96 | oh thought they had the same names heh |
22:52:20 | dom96 | It's getting late |
22:52:50 | dom96 | You should remove '| AsyncHttpClient' though |
22:53:06 | FromGitter | <xmonader> @dom96 I renamed it. Problem is if i keep the async code part in the whenIsMainModule it never returns |
22:53:29 | FromGitter | <xmonader> when i keep all the other parts checkSequentially and threadsCheck it continues and exits |
22:54:04 | dom96 | I tried with both 0.17.0 and devel and it's working |
22:57:12 | FromGitter | <xmonader> https://imgur.com/a/sFZZQ :( sad on 0.17.0 |
22:57:38 | * | themagician quit () |
22:58:22 | FromGitter | <xmonader> @dom96 can you try this? https://gist.github.com/xmonader/10cd5ccbc7f24b35910010e0dccca71a and tell me if it exits cleanly on ur machine? |
22:58:57 | dom96 | yep, works fine |
22:59:08 | dom96 | Maybe it's a OS-specific issue? what OS are you on? |
22:59:20 | FromGitter | <xmonader> I'm on archlinux |
23:00:21 | dom96 | Anybody else on Linux that can test this? |
23:02:09 | * | vlad1777d quit (Remote host closed the connection) |
23:03:36 | FromGitter | <xmonader> @dom96 What OS do you use? |
23:04:25 | dom96 | macOS |
23:05:25 | FromGitter | <qqtop> openSuse Tumbleweed on 0.17.1 : works fine |
23:06:03 | dom96 | weird |
23:06:50 | FromGitter | <xmonader> @qqtop suse also uses the rolling release model so i expect u to have the latest packages as well |
23:07:06 | FromGitter | <xmonader> @dom96 what other information can I provide u with? |
23:09:11 | dom96 | Not sure. I think the best thing for you to do is try getting Nim devel and see if it works there. |
23:09:47 | FromGitter | <xmonader> Sure. let me try that |
23:10:21 | FromGitter | <xmonader> Should I use choosenim or manually? |
23:10:31 | dom96 | choosenim might be easier |
23:10:49 | dom96 | just make sure you remove the old installation well |
23:11:17 | FromGitter | <xmonader> okay thank you |
23:13:20 | FromGitter | <xmonader> Internet is so great in Egypt :( |
23:13:49 | FromGitter | <abijahm> hello guys, how would implement a type that holds items of different types |
23:14:38 | FromGitter | <Yardanico> Wait |
23:14:58 | FromGitter | <Yardanico> You want to have a sequence of items with different types? |
23:15:14 | FromGitter | <xmonader> That's a tuple :D |
23:15:14 | FromGitter | <Yardanico> Like [1, "hi"] in python? |
23:16:13 | FromGitter | <abijahm> no a table of items of different types with keys |
23:16:41 | FromGitter | <xmonader> In python it depends on if the key is hashable only. not sure about nim |
23:17:21 | FromGitter | <Yardanico> Well you can do almost the same thing with object variants |
23:17:45 | FromGitter | <Yardanico> But please don't forget that Nim is a compiled language without runtime vm |
23:18:07 | FromGitter | <Yardanico> So you can't for example have a sequence of different types |
23:19:13 | FromGitter | <abijahm> or maybe i will have to transform the objects to JsonNodes |
23:19:33 | FromGitter | <Yardanico> Also wait, what are you using table for? |
23:19:41 | FromGitter | <Yardanico> Pattern matching? |
23:20:37 | dom96 | Indeed, you need an object variant |
23:20:48 | dom96 | So you likely can reuse JsonNode for your purposes. |
23:22:12 | FromGitter | <abijahm> no am trying to implement a middleware stack for asynchttpserver like express am using a table to store the context |
23:23:46 | dom96 | what does this context contain? |
23:27:56 | FromGitter | <abijahm> objects parsed from a request eg form data into a object |
23:28:26 | FromGitter | <abijahm> from a http request |
23:29:17 | dom96 | That's all mostly a Table[string, string], no? |
23:29:31 | * | Snircle joined #nim |
23:29:42 | dom96 | You shouldn't have trouble with that and types. |
23:31:10 | * | Yardanico quit (Read error: Connection reset by peer) |
23:31:32 | FromGitter | <xmonader> How big is the nim devel :D ? |
23:32:42 | * | TjYoco joined #nim |
23:32:58 | dom96 | xmonader: how fast is it downloading for you? :) |
23:33:26 | FromGitter | <xmonader> 24mb 208kb/s :S |
23:38:36 | dom96 | Might take some time unfortunately |
23:39:35 | FromGitter | <xmonader> It's okay I may take extra nap xD |
23:41:10 | FromGitter | <xmonader> @dom96 are there any documentation on the internals of nim and the development process? |
23:41:35 | FromGitter | <xmonader> I'm pretty curious about the generated C code as well, how do I get more insights? |
23:41:39 | dom96 | https://nim-lang.org/docs/intern.html |
23:41:46 | dom96 | That has some info |
23:42:13 | FromGitter | <xmonader> Oh Thank you ^_^ |
23:45:05 | FromGitter | <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:51 | dom96 | You sure your internet just isn't super slow? :) |
23:51:09 | dom96 | what stack trace do you get when you terminate it? |
23:51:53 | FromGitter | <xmonader> It took like 15 mins :S |
23:52:03 | FromGitter | <xmonader> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ab4423614889d475b4f20b] |
23:52:10 | * | relax joined #nim |
23:53:08 | dom96 | one quick thing you can try: compile with -d:upcoming |
23:53:44 | * | thomasross joined #nim |
23:54:07 | FromGitter | <xmonader> sorry didn't work |
23:54:14 | FromGitter | <xmonader> what's is that flag for |
23:58:06 | dom96 | It uses a slightly newer async dispatcher |
23:58:22 | dom96 | only thing you can do now is debug this I'm afraid |
23:58:25 | dom96 | you can use strace for this |
23:58:42 | dom96 | or start adding debug statements throughout your code (and the stdlibs code) to see what's going on |
23:59:20 | FromGitter | <xmonader> I shall! Thank you a lot @dom96 I'll keep you guys posted about this |
23:59:55 | * | TjYoco quit (Quit: Page closed) |