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