00:01:08 | * | gmpreussner joined #nim |
00:02:58 | skrylar | netsplits :b |
00:03:47 | * | skrylar quit (Remote host closed the connection) |
00:08:35 | * | avsej quit (Ping timeout: 258 seconds) |
00:08:49 | * | oprypin quit (Quit: Bye) |
00:09:31 | * | oprypin joined #nim |
00:09:44 | * | FromGitter quit (Ping timeout: 246 seconds) |
00:10:44 | * | FromGitter joined #nim |
00:13:48 | * | avsej joined #nim |
00:13:48 | * | avsej quit (Changing host) |
00:13:48 | * | avsej joined #nim |
00:16:01 | * | gmpreussner quit (Quit: kthxbye) |
00:16:49 | * | gmpreussner joined #nim |
00:33:07 | * | Jesin quit (Quit: Leaving) |
00:35:55 | * | Jesin joined #nim |
00:45:02 | * | Jesin quit (Quit: Leaving) |
00:46:43 | libman | https://dubst3pp4.github.io/post/2017-10-03-why-i-use-object-pascal/ |
00:47:19 | * | Jesin joined #nim |
00:47:20 | * | darkn0de joined #nim |
00:47:57 | darkn0de | I'm trying to get TLS to fail on a bad host certificate... but it doesn't look like it ever will. |
00:48:05 | * | guelosk quit (Ping timeout: 260 seconds) |
00:48:30 | darkn0de | Looking carefully at openssl.nim, it appears that a lot of openssl symbols are not ex(im)ported |
00:48:54 | darkn0de | getting net.nim to properly verify certs is going to be challenging... |
00:50:08 | darkn0de | I'll be back in in an hour... but have a couple of interesting things though: http://bradconte.com/using-load_verify_locations https://github.com/nim-lang/Nim/issues/782 https://wiki.openssl.org/index.php/Manual:SSL_CTX_load_verify_locations(3) https://wiki.openssl.org/index.php/Manual:SSL_CTX_set_verify(3) |
00:50:28 | darkn0de | in short.. think we're doing it wrong. :) |
00:57:54 | * | NimBot joined #nim |
01:05:02 | * | Snircle quit (Ping timeout: 246 seconds) |
01:07:29 | * | ipjk quit (Quit: Leaving) |
01:24:47 | * | Snircle joined #nim |
01:48:13 | * | voiceftp quit (Ping timeout: 255 seconds) |
02:08:02 | * | dhalinar quit (Ping timeout: 246 seconds) |
02:10:24 | * | JappleAck quit (Quit: Leaving) |
02:10:32 | * | endragor_ joined #nim |
02:40:06 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
02:47:40 | * | Nobabs27 quit (Quit: Leaving) |
02:58:47 | * | libman quit (Quit: Connection closed for inactivity) |
03:10:01 | * | smt quit (Ping timeout: 240 seconds) |
03:30:02 | * | koranza joined #nim |
05:22:20 | * | voiceftp joined #nim |
05:43:28 | * | Kingsquee joined #nim |
06:01:02 | * | rakish joined #nim |
06:01:08 | * | rakish left #nim ("Leaving") |
06:02:44 | * | claudiuinberlin joined #nim |
06:02:57 | * | claudiuinberlin quit (Client Quit) |
06:11:06 | * | PMunch joined #nim |
06:15:56 | * | nsf joined #nim |
06:23:48 | * | vlad1777d joined #nim |
06:29:31 | * | Laon joined #nim |
06:34:55 | * | gokr joined #nim |
06:35:55 | * | Arrrr joined #nim |
06:35:55 | * | Arrrr quit (Changing host) |
06:35:55 | * | Arrrr joined #nim |
06:49:03 | * | Trustable joined #nim |
06:49:29 | * | dddddd quit (Remote host closed the connection) |
06:52:58 | * | Ven joined #nim |
06:53:21 | FromGitter | <Varriount> Yardanico: Your English is way better than my German. |
06:53:21 | * | Ven is now known as Guest65906 |
06:54:21 | FromGitter | <Varriount> If you talk even half as well as you write, you'll be quite understandable. |
06:56:22 | PMunch | Huh, the reddit topic for yesterdays stream had ~20 upvotes when I went to bed. Now it's >70 |
06:58:58 | Arrrr | What did you learn from the stream? |
07:14:05 | * | miran joined #nim |
07:17:59 | * | claudiuinberlin joined #nim |
07:26:44 | * | Guest65906 quit (Read error: No route to host) |
07:27:21 | * | Ven_ joined #nim |
07:35:03 | FromGitter | <dom96> Araq's destructors blog post is on HN front page ⭕ |
07:35:13 | FromGitter | <dom96> *:o |
07:39:24 | PMunch | Nice! |
07:39:33 | PMunch | It was an interesting read |
07:42:25 | livcd | where is the video from araq about destructors ? i can't seem to find it |
07:44:28 | FromGitter | <mratsim> Waiting for edits |
07:44:46 | Arrrr | "we get a much nicer state len == 0 that is not as prone to crashes as nil" what is index out of bounds |
07:45:09 | livcd | dom96 is it ? not in my feedly.... |
07:46:15 | PMunch | Arrrr, true but with "for x in y" it would simply skip if it had len == 0 |
07:46:44 | Arrrr | mmm, that's right. Not that it solves every problem |
07:50:35 | Arrrr | is sink implemented? |
07:51:43 | Arrrr | I don't see the reason to use sink in the provided example |
07:54:02 | Arrrr | "return values tend to be bad for high performance code" wtf |
07:54:24 | PMunch | Yup |
07:54:53 | PMunch | I don't think sink is implemented, he mentions that there really isn't a need for it at the end of the article |
07:56:54 | * | Andris_zbx joined #nim |
07:58:53 | Arrrr | But you have to replace procs with templates |
08:02:43 | Arrrr | Interesting article, there should be more documentation on what moves generates garbage |
08:02:49 | * | Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:03:05 | * | Ven joined #nim |
08:03:28 | * | Ven is now known as Guest16823 |
08:10:02 | * | Arrrr quit (Read error: Connection reset by peer) |
08:10:32 | miran | most of the discussion on that link is about c++ as far as i could tell from briefly going trough comments.... |
08:11:50 | gokr | He, interesting: https://github.com/Microsoft/napajs |
08:12:41 | gokr | Freaking js is seeping in everywhere. |
08:14:30 | PMunch | It's so strange |
08:14:44 | PMunch | I don't really understand what makes people so obsessed with JS |
08:15:40 | euantor | Lots of documentation that is easy for beginners to understand. Lots of tools to aid development and to aid learning. Lots of people know the language already so can help others learn. |
08:16:03 | PMunch | Maybe it has something to do with accessibility? And I think most programmers have at some point taken a look at JS if they wanted to do something on a web-page so it's a lot of exposure as well.. |
08:16:13 | euantor | it has its quirks, but it sure is easy to dive in and get something working |
08:16:22 | PMunch | euantor, yeah now that's true. But how did that all start? |
08:16:52 | euantor | Mostly because it is/was the _only_ choice for writing an interactive web page. As the web has grown, so too has JS |
08:17:02 | PMunch | It's not that long ago that JS was just a horrible cross-platform mess for browsers to scrape by on |
08:17:32 | euantor | then v8 came along and web developers realised they could start writing the same code for both backend and frontend |
08:17:41 | PMunch | Yeah, I guess it was just a case of everyone knowing it since it was the only choice for web, then it just spiraled from there |
08:20:53 | * | Arrrr joined #nim |
08:24:49 | euantor | Yep, and now we have desktop apps running inside Chrome instances wasting memory |
08:26:43 | PMunch | Hoorah |
08:29:01 | Arrrr | all your apps are belong to us |
08:32:03 | FromGitter | <dandevelo> So is Nim moving to a no-GC world? |
08:32:18 | * | JappleAck joined #nim |
08:33:42 | crem | That's a nice world. |
08:34:30 | FromGitter | <dandevelo> I was hoping for a "Yes" answer :D |
08:34:48 | FromGitter | <dandevelo> Now looking for the "when" answer |
08:36:27 | euantor | It's a while off yet |
08:38:00 | Arrrr | i hope gc is still supported in the future |
08:39:03 | * | Laon quit () |
08:41:13 | euantor | Regarding the earlier > "return values tend to be bad for high performance code" wtf |
08:42:14 | euantor | Isn't `result` currently a way to get around that? I seem to remember that it's allocated in the caller's stack frame or something |
08:42:42 | euantor | I remember it being mentioned here a while back anyway, but can't remember what was actually said |
08:43:23 | Araq | dandevelop: it's moving into this direction but it's in the "early prototype" stage. I think we should release v1 by the end of this year and then do more experiments |
08:43:34 | Araq | the perfect is the enemy of the good or something like that |
08:44:22 | Araq | euantor, read my blog. the problem is that the semantics are different, you cannot optimize semantic differences ;-) |
08:44:45 | euantor | Currently reading it now, only just got to that sentence :) |
08:47:34 | Arrrr | Can't you move it? |
08:52:24 | FromGitter | <dom96> @Araq please start answering questions here https://news.ycombinator.com/item?id=15512249 |
08:55:44 | * | rebellis quit (Ping timeout: 260 seconds) |
08:57:10 | miran | Araq: so this is something for v2.0? |
08:59:33 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:06:01 | Araq | miran, I think so. |
09:07:19 | Araq | though most users that have big Nim projects out there do not really care about the version, they want the language to evolve and do not mind code breakages that much. ymmv. |
09:08:09 | PMunch | Hmm, in a macro is it possible to get the actual type of a distinct int from a typed argument |
09:08:25 | PMunch | getType only gives me distinct int |
09:08:39 | miran | learn from python2/python3 language evolution :D |
09:08:39 | Araq | PMunch, getTypeImpl |
09:08:53 | PMunch | Thanks :) |
09:12:52 | PMunch | Hmm, that didn't seem to work |
09:13:17 | PMunch | getTypeInst seems to work though |
09:19:04 | suswombat__ | Hey everyone |
09:19:41 | * | Guest16823 quit (Ping timeout: 240 seconds) |
09:20:45 | Arrrr | hello my friend |
09:37:35 | * | zolk3ri joined #nim |
09:38:15 | miran | https://news.ycombinator.com/item?id=15512249 still has the most comments about other programming languages, rather than nim :( |
09:40:44 | livcd | Araq: maybe that's just because these are not serious projects or "we invested money/effort" projects. I would say code breakage is painful :S |
09:42:22 | Araq | livcd, er excuse me? they definitely invested good money |
09:44:09 | livcd | ah ok |
09:44:31 | livcd | i thought you were talking in general |
09:45:17 | livcd | so you are saying the big projects that use Nim do not mind code breakages that much because they have the resources to deal with them |
09:48:26 | * | claudiuinberlin joined #nim |
09:48:42 | FromGitter | <andreaferretti> @Araq there is a inherent bias. The big projects that exist *right now* are more likely to accept breakage because the possible big project that do not accept it are not started until a stable v1 comes out |
09:49:04 | FromGitter | <andreaferretti> You also have to look at the projects that do not exist :-) |
09:49:18 | FromGitter | <andreaferretti> Exactly because of this reason |
09:49:34 | suswombat__ | Naive noob question. What code is going to break? |
09:53:23 | FromGitter | <Yardanico> No code is going to break now |
09:53:23 | federico3 | yours |
09:53:40 | suswombat__ | federico3, damn :/ :D |
09:53:44 | federico3 | suswombat__: sorry, I couldn't resist :D |
09:54:17 | suswombat__ | federico3, no worries it was propably a dumb question anyways :) |
09:56:03 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:56:12 | federico3 | breakage is not a binary thing. If code breaks with a deprecation warning and a clear hint on how to fix it it's a small nuisance. If it breaks in silent, subtle ways it's really bad. |
09:57:36 | livcd | sure i mean how many changes and breaks there have been for swift ? :) |
10:01:04 | * | Ven joined #nim |
10:01:06 | * | claudiuinberlin joined #nim |
10:01:27 | * | Ven is now known as Guest83993 |
10:01:56 | * | Guest83993 quit (Client Quit) |
10:02:09 | euantor | put it this way: each time there's a new Swift release there's also a new Swift code migration tool release ;) |
10:02:30 | euantor | THe fact they have to provide such a tool to migrate code to a new verison shows that BC is clearly not a priority |
10:04:47 | FromGitter | <MartinPercossi_twitter> hi everyone |
10:06:21 | FromGitter | <MartinPercossi_twitter> I saw araq's post about manual mem management on HN. Super excited about this. I gave nim a spin a couple of years back and liked what I saw, but for me GC is an issue because a) I'm a c++ dev and memory management is not that hard once you know what you're doing and b) because I'm an audio dev (my company: https://zenaud.io ) and GC is something that I need to circumvent. |
10:09:27 | FromGitter | <mratsim> @euantor it's true return values are "much" slower for ref type (if in hot path), due to multiple call to the GenericReset, Memset 0, checkNil. There are ways around that: templates, using result, using {.noInit.} |
10:09:45 | PMunch | Hi Martin, yeah the new GC less features will open a couple doors for Nim I think |
10:11:02 | FromGitter | <mratsim> Hi Martin, it's not hard to avoid GC, I just use `type Foo = ptr object` or `type Foo = ptr UncheckedArray[int]` |
10:12:22 | FromGitter | <mratsim> I'm writing a high performance tensor library in Nim and you sometimes I just want no GC array or no GC objects, sometimes I want the GC and there are some tricks to make it behave |
10:14:06 | Araq | mratsim: Not sure if that's not simply a codegen bug though, I wouldn't draw theoretical conclusions from this |
10:14:32 | suswombat__ | Anyone in here using vscode for nim and can tell me how much memory the nimsuggest processes spawned by the nim extension use? |
10:14:40 | * | suswombat__ is now known as suswombat |
10:14:56 | Araq | suswombat, too much, omg :-) |
10:15:06 | FromGitter | <mratsim> @Araq yes probably, I think they are all reported |
10:15:27 | FromGitter | <Yardanico> Suswombat: nimsuggest usually uses 100-300mb |
10:15:32 | suswombat | Araq, was that a sarcastic answer? not sure sry |
10:15:32 | FromGitter | <Yardanico> But sometimes can leak |
10:15:36 | PMunch | What!? |
10:15:39 | PMunch | That's crazy |
10:15:50 | FromGitter | <mratsim> @suswombat__ the issue is the number of nimsuggests that are spawned ... And the CPU eaten |
10:16:31 | suswombat | so this is normal? https://i.imgur.com/qaKGCHb.png |
10:16:53 | FromGitter | <MartinPercossi_twitter> My two cents: there's a once-in-a-generation opportunity for a language to become "the next C++". This is because C++ has acquired so much baggage that it is very difficult for noobs to learn. In addition, the pace of change of the project is relatively slow due to design-by-committee. To my mind, the race is on for some language to offer similar performance characteristics ("leave no space below"), and |
10:16:53 | FromGitter | ... indeed several languages, like C2, Zig, and not the least, Rust, have emerged in a bid to claim that space. When you look at the popularity of python, it is due to a number of factors but the intuitive syntax is a clear selling point. And nim is very similar in this regard. Now I realize that GC is a very useful te ... [https://gitter.im/nim-lang/Nim?at=59e9cd15f7299e8f530ea77f] |
10:16:58 | Arrrr | is `return "String"` optimized to "result = "String" ? |
10:17:34 | FromGitter | <Yardanico> No |
10:17:42 | FromGitter | <Yardanico> But I may be wrong |
10:19:10 | FromGitter | <Yardanico> @MartinPercossi_twitter Nim's GC is more performant than Java or C# or Go |
10:19:16 | Araq | Arrrr, pretty much, it is |
10:19:40 | FromGitter | <Yardanico> And there's no stop the world |
10:19:54 | FromGitter | <Yardanico> Also you can use realtime gc |
10:19:54 | Araq | dom96, I see interesting comments but no questions I should answer |
10:20:18 | Arrrr | Fine then |
10:20:37 | dom96 | Araq: Engage with them. |
10:20:41 | dom96 | There really are questions though... |
10:20:43 | dom96 | https://news.ycombinator.com/item?id=15514374 |
10:20:48 | FromGitter | <mratsim> Just say hi, "We want you, Nim recruits" |
10:21:39 | dom96 | Better yet, write a top-level comment saying "Author of the article here, thank you for submitting it. Feel free to AMA." |
10:22:41 | Arrrr | This |
10:23:14 | Arrrr | You need more exposition Araq, is for the good of this community |
10:23:50 | * | Ven_ joined #nim |
10:24:12 | FromGitter | <mratsim> @MartinPercossi_twitter It's probably not advertised enough but Nim GC is easily deactivated AND there are 4 implementations: deferred RC, Mark and Sweep, Memory Region, Real-time (max pause tunable) and you can directly access Nim memory allocator/free. |
10:25:03 | FromGitter | <Yardanico> Also boehm gc |
10:25:17 | FromGitter | <Yardanico> And Go a |
10:25:24 | FromGitter | <Yardanico> Go GC :D |
10:25:30 | FromGitter | <mratsim> There is a huge stigma with GC but it doesn't have to be that way, as evidenced by the number of game programmer (and game framework bindings). Stopping the game due to GC is a big no-no. |
10:25:48 | FromGitter | <mratsim> Ah forgot about Boehm |
10:27:52 | * | Vladar joined #nim |
10:28:14 | FromGitter | <GooRoo> Hi guys. Sorry that I'm interrupting your discussion, but have a small off-topic question: is there anything like Either from Haskell or std::variant from C++ in Nim's standard library? |
10:29:15 | Arrrr | Nope, only Option. I'd like to see Either in the stblib |
10:29:42 | FromGitter | <GooRoo> I see... okay then :) thanks |
10:29:46 | FromGitter | <Yardanico> You can implement your own though :P |
10:29:47 | FromGitter | <MartinPercossi_twitter> @mratsim - as I mentioned, I realize that there are merits to GC for certain types of tasks. And I agree that some of the stigma against them is unwarranted. That said: GC is a well-researched topic. I'm sceptical that Nim provides some new "special sauce" that makes it much more performant than other, more mature, implementations. In addition, the advances in C++, Rust, and Swift show that using smart |
10:29:47 | FromGitter | ... pointers along with RAII can alleviate much of the cognitive burden imposed by manually tracking memory. So my feeling is that the tide is turning against GC, and with the increased importance of low-power-consumption, it seems likely that this trend could continue for some time. |
10:30:12 | PMunch | There is this Either, from nimfp: https://github.com/vegansk/nimfp/blob/master/src/fp/either.nim |
10:30:26 | PMunch | GooRoo ^ |
10:30:36 | FromGitter | <MartinPercossi_twitter> Therefore I would prefer that the language sticks more to value semantics, and abandons GC :) But again, just my two cents and I realize I'm not really a contributing member of this community so feel free to ignore my comments! :) |
10:30:48 | FromGitter | <GooRoo> @Yardanico I can implement my own one in Haskell as well, but it's still present in standard library though ;) |
10:31:45 | PMunch | MacrtinPercossi_twitter, all comments are welcome :) Just as important to hear what "outsiders" mean |
10:32:21 | PMunch | GooRoo, often you see the kind pattern used in eg. the Json module |
10:32:33 | FromGitter | <Yardanico> @GooRoo well Nim is not a functional language. It has some functional features, but still. |
10:32:44 | FromGitter | <MartinPercossi_twitter> @mratsim - realtime GC -- I'm guessing this is not stop-the-world. What happens if I have multiple threads? Can memory be shared across them? Or am I restricted to message-passing/channel type mechanism? |
10:32:54 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:33:10 | FromGitter | <Yardanico> You can share memory with raw pointers |
10:33:19 | PMunch | GooRoo, this: https://nim-lang.org/docs/json.html#JsonNodeObj |
10:33:26 | FromGitter | <MartinPercossi_twitter> @Yardanico cool |
10:33:28 | FromGitter | <Yardanico> Or channels/spawn |
10:34:04 | dom96 | @GooRoo: if you create a PR to add an Either type to the stdlib then I'll be happy to accept it :) |
10:34:07 | FromGitter | <MartinPercossi_twitter> Yeah most people are doing it with channels nowadays, which makes sense because they make certain types of comm elegant. |
10:34:31 | FromGitter | <MartinPercossi_twitter> If I use channels can I guarantee that a realtime thread will never call malloc? |
10:35:22 | FromGitter | <Yardanico> I don't think you can use different GC for different channels |
10:35:33 | FromGitter | <Yardanico> *threads |
10:35:47 | FromGitter | <MartinPercossi_twitter> In c++ how I handle this is I have a ring buffer with max msg size, each entry is an inplace_function, this allows a task framework (see Sean Parent's work) but in a RT scenario. |
10:36:06 | FromGitter | <mratsim> @MartinPercossi_twitter I use OpenMP in my tensor library with shared memory |
10:36:14 | FromGitter | <MartinPercossi_twitter> I would expect you can't use different GC on different threads. |
10:36:43 | FromGitter | <MartinPercossi_twitter> @mratsim right but my guess is that tensor lib cares about throughput but not so much about latency. |
10:36:55 | FromGitter | <GooRoo> @Yardanico Do std::variant, QVariant, or raw union after all belong to functional programming? It's just a data structure |
10:37:17 | FromGitter | <GooRoo> @PMunch, thanks, I use exactly the same approach |
10:37:21 | dom96 | @MartinPercossi_twitter: Thank you for joining to give us your opinion. Personally I wouldn't have started using Nim without a GC. I definitely want the support for no GC to be expanded, I don't mind how that is done as long as I can continue to use the GC as I do now. |
10:37:34 | FromGitter | <GooRoo> @dom96, I'll think about it -) |
10:37:35 | dom96 | But let's not get rid of GC completely :) |
10:38:31 | euantor | I think no GC in the stdlib would be really nice, then leave consumers to decide if they want/need a GC |
10:38:46 | euantor | I believe that is the direction that D is trying to ehad in too |
10:38:49 | euantor | *head |
10:39:09 | FromGitter | <mratsim> @MartinPercossi_twitter Indeed, in any case, I had to drop to very low-level memory management, with shared memory because it’s the only way to do parallelism on 1GB~8GB tensor objects so it’s possible. And for latency better to ask all the game devs in the Nim community ;) |
10:39:20 | FromGitter | <MartinPercossi_twitter> Thanks for the warm welcome, @dom96 ! I agree that there's no need to remove it, my feeling is that you can simply add a nice set of value types that exist outside of its operation. |
10:40:04 | FromGitter | <MartinPercossi_twitter> @euantorano - I second your opinion of no GC in stdlib. |
10:40:21 | FromGitter | <mratsim> @MartinPercossi_twitter you might be interested in my article about low level memory management in Nim: https://andre-ratsimbazafy.com/high-performance-tensor-library-in-nim/#how-low-level-memory-management-in-nim |
10:40:22 | FromGitter | <MartinPercossi_twitter> Dlang is a cautionary tale here ;) |
10:40:57 | FromGitter | <MartinPercossi_twitter> I already read it a few days ago, @mratsim -- really interesting article and nice job! |
10:40:58 | FromGitter | <Yardanico> @MartinPercossi_twitter what do you mean by value types? Simple Nim objects don't need GC |
10:41:21 | FromGitter | <Yardanico> Floats, ints, etc work without GC |
10:41:42 | FromGitter | <MartinPercossi_twitter> @Araq 's article mentions making e.g. containers behave like value types. This is a IMHO a good idea. |
10:41:43 | dom96 | Yardanico: that is what value types are |
10:41:44 | FromGitter | <Yardanico> Strings and sequences will work without GC in the near future |
10:43:28 | FromGitter | <MartinPercossi_twitter> I personally prefer everything to be value types, by which I mean, I' |
10:44:06 | FromGitter | <MartinPercossi_twitter> I'm not a huge fan of hybrid type systems where there are some "reference" objects (classes) and then there are "structs" which obey value semantics, have destructors, etc. |
10:44:29 | FromGitter | <MartinPercossi_twitter> Because then the question invariably arises "should my Foo be a class or a struct"? |
10:45:18 | FromGitter | <MartinPercossi_twitter> And usually you end up going for a class, and then everything becomes a big object salad like in Java. The gravitational pull of reference semantics is extremely strong for some reason. |
10:45:28 | Arrrr | In nim the question usually is "Object or Tuple?" |
10:46:00 | FromGitter | <Yardanico> They're the same if no object inheritance is used |
10:46:09 | FromGitter | <Yardanico> I mean the same in memory layout |
10:46:47 | FromGitter | <MartinPercossi_twitter> Right but what about constructors/destructors? Objects allocated with GC will typically not have destructors invoked (at least not using scopes, i.e. deterministically) |
10:46:52 | dom96 | Arrrr: I don't think that's true |
10:49:16 | FromGitter | <MartinPercossi_twitter> At the risk of being rude: is there any time-frame with regard to @Araq 's proposed changes? Any design documents? I would be love to take a look at anything that's there. |
10:51:25 | euantor | Well the destructors work has been commited to the repository and I believe @Araq was going to add a Wiki page |
10:51:46 | euantor | https://github.com/nim-lang/Nim/commit/35c8b5e3bcc13ade6441f1b53ee8d3acacffded3 |
10:51:50 | euantor | https://github.com/nim-lang/Nim/commit/7b8c8f3e482e3b22cd1eeaa67ee6f5cb71ae84e1 |
10:51:54 | euantor | (and several others) |
10:52:24 | FromGitter | <mratsim> There is no classes in Nim so no gravitational pull ;). However what is asked recurrently is “How to do an interface in Nim?" |
10:52:51 | euantor | And it doesn't look like the Wiki page is up yet. That blog post is probably the closest there is to a design document/specification |
10:53:07 | euantor | Time frame is not this year - the plan this year is for v1 as far as I understand |
10:53:35 | dom96 | https://news.ycombinator.com/item?id=15514806 |
10:53:50 | dom96 | Araq: Keep an eye out and answer questions :) |
10:53:59 | dom96 | bbl, lecture time |
10:57:36 | FromGitter | <Yardanico> @mratsim as Araq says (and that's true) - interface is just an array of closures |
10:58:46 | FromGitter | <Yardanico> And there are libraries for Nim which can autogenerate these for you |
10:58:58 | Araq | MartinPercossi_twitter: plans are constantly changing but I expect the destructor feature to be useful within weeks, making it replace the GC within years :-) but what makes this discussion really hard is that the terms are so fuzzy |
11:00:32 | * | sleepyqt joined #nim |
11:00:38 | Araq | strings and seqs mostly change in the implementation, it's not much of a breaking change and 'ref' could become an atomic RC'ed pointer with "trial deletion" for cycle detection |
11:01:01 | Araq | same language, completely different runtime profile |
11:01:22 | * | Ven joined #nim |
11:01:45 | * | Ven is now known as Guest21513 |
11:01:47 | Araq | my educated guess, "slower but works with the outside world and much more helpful for multi threading things" |
11:02:09 | * | Ven_ quit (Read error: Connection reset by peer) |
11:02:12 | * | Snircle joined #nim |
11:03:14 | FromGitter | <mratsim> I think the move/sink would bring speed in my use case. And I would love to have a fast tensor library with value semantics, even on GPU. |
11:03:48 | Araq | "And usually you end up going for a class, and then everything becomes a big object salad like in Java. The gravitational pull of reference semantics is extremely strong for some reason." excellent remark, I agree completely |
11:07:05 | * | endrago__ joined #nim |
11:07:45 | * | endragor_ quit (Ping timeout: 248 seconds) |
11:09:42 | FromGitter | <MartinPercossi_twitter> @Araq - thanks for the time estimate, I realize that for big projects such estimates are hard to give. Your changes sound extremely attractive, as I said I find the language very elegant and powerful, and would love to see these additions in due time. |
11:11:43 | Araq | well additions are easy, it's the replacement of the existing runtime with a different one that causes stomach ache |
11:12:31 | Araq | I can see "ok, I can write my own seqs now, that's all I really need" working out for many people but eventually new stuff should replace old stuff |
11:20:26 | FromGitter | <Yardanico> Araq: Btw, will opt type will be available before 1.0? |
11:20:38 | FromGitter | <Yardanico> *type be |
11:21:35 | FromGitter | <edubart> @Araq in the destructors post, I liked the idea of having `result` as a var in the last parameter of a proc instead of the traditional way of returning, this would generate much more optimized C code as I've noticed that few days ago. I thought of redoing my procs like that, but would make the code not so readable, so instead of using result as a var param everywhere, or not using, I ended up with a mix where I needed |
11:21:35 | FromGitter | ... more performance, and using lots of `{.noInit.}` where I used the traditional result |
11:22:46 | * | Yardanico joined #nim |
11:23:36 | FromGitter | <MartinPercossi_twitter> Completely unrelated question: can the community recommend a command-line parsing library? commandeer and cligen look interesting, if anyone has experiences with these libs I |
11:23:40 | FromGitter | <MartinPercossi_twitter> I'd be happy to hear. |
11:24:17 | Yardanico | there's also docopt |
11:25:01 | Yardanico | https://github.com/docopt/docopt.nim |
11:26:02 | FromGitter | <MartinPercossi_twitter> @Yardanico thanks |
11:26:36 | FromGitter | <dandevelo> How can I generate a string with the parameter name from a parameter passed to a template? |
11:27:28 | FromGitter | <dandevelo> template(SOMETHING) = echo "You passed " & ? what ? should be in order to output "You passed SOMETHING" |
11:29:56 | FromGitter | <mratsim> @dandevelo astToStr |
11:30:54 | * | sleepyqt quit (Quit: WeeChat 1.9.1) |
11:32:38 | * | sleepyqt joined #nim |
11:34:39 | * | claudiuinberlin joined #nim |
11:36:41 | * | claudiuinberlin quit (Client Quit) |
11:41:41 | FromGitter | <dandevelo> Thanks @mratsim! That's what I needed |
11:42:37 | Yardanico | mratsim: didn't knew about that one, thanks too :D |
11:43:27 | FromGitter | <mratsim> You write too much macros and not enough templates ;) |
11:43:30 | Arrrr | Some comments on reddit too about the blog post |
11:43:38 | Yardanico | mratsim: probably |
11:45:02 | FromGitter | <mratsim> wow people are aggressive @Arrrr |
11:45:16 | * | PMunch_ joined #nim |
11:45:38 | * | PMunch quit (Disconnected by services) |
11:45:42 | * | PMunch_ is now known as PMunch |
11:45:51 | Yardanico | Arrrr, where? |
11:45:54 | * | claudiuinberlin joined #nim |
11:46:05 | Yardanico | oh wait, someone shared araq blog post on programming? |
11:46:15 | Yardanico | oh, I see |
11:46:20 | Arrrr | https://www.reddit.com/r/programming/comments/77ko76/nim_pointer_free_programming/ |
11:46:28 | Yardanico | yeah, I found it |
11:46:44 | Arrrr | The return thing probably is because ignores the existance of result |
11:47:04 | Arrrr | *existence |
11:48:17 | Yardanico | guys |
11:48:24 | FromGitter | <mratsim> The poster thought it was “harmful for everyone" |
11:48:36 | Yardanico | we have two nim related posts on /r/programming in the top 15 |
11:48:40 | FromGitter | <mratsim> (not Nim limited) |
11:48:50 | Yardanico | araq's stream - 14, blog post - 7 |
11:48:56 | Yardanico | :P |
11:52:16 | * | dddddd joined #nim |
11:57:16 | * | Guest21513 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:05:33 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:07:57 | * | suswombat quit (Ping timeout: 240 seconds) |
12:08:52 | * | FromGitter quit (Ping timeout: 258 seconds) |
12:12:43 | * | claudiuinberlin joined #nim |
12:14:03 | * | couven92 joined #nim |
12:14:15 | * | Ven joined #nim |
12:14:38 | * | Ven is now known as Guest72916 |
12:19:27 | * | arecaceae joined #nim |
12:19:37 | * | Arrrr quit (Read error: Connection reset by peer) |
12:24:44 | Yardanico | dom96, will you need a twitch-relay enabled for your channel? |
12:24:51 | Yardanico | on today's stream |
12:25:00 | dom96 | sure |
12:25:39 | Yardanico | dom96, just do "/mod FromIRC" so we won't hit message rate limit :P |
12:25:48 | Yardanico | I'll start it now |
12:26:39 | dom96 | Yardanico: done |
12:26:43 | * | FromTwitch joined #nim |
12:26:45 | dom96 | Araq: Can you autohost my channel? |
12:26:55 | Yardanico | dom96, I've enabled it |
12:27:29 | dom96 | Yardanico: thx |
12:27:55 | PMunch | Should we put it in a separate room this time? |
12:28:26 | Yardanico | Araq, dom96 asks you to host his channel - go to https://www.twitch.tv/settings/channel, there's "Host List" - add d0m96 here |
12:28:32 | PMunch | Not saying that I think we should, but maybe? |
12:28:45 | Yardanico | PMunch, what about gitter ? :( |
12:28:53 | arecaceae | does async come with an impl. for subprocesses ? - like I'm trying to run always 5 subprocess at a time from a bigger list of things, so I want to block as long as 5 subprocesses are running but once one finishes I want to start the next one, any pointers? |
12:29:07 | PMunch | Ah right, we'll miss those.. |
12:29:15 | Yardanico | arecaceae, you can use https://github.com/cheatfate/asynctools |
12:29:20 | Yardanico | there's asyncproc |
12:29:23 | dom96 | arecaceae: there are a couple async osproc implementations that you can use |
12:29:38 | dom96 | I'm happy to keep the relay in this channel |
12:29:41 | Yardanico | dom96, , Ideally I would like if we would create a new gitter room and connect it to #nim-offtopic |
12:29:51 | dom96 | Araq: Once you do what Yardanico instructed, make sure to enable "Auto host" as well |
12:30:04 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:30:30 | arecaceae | dom96: can recommend any specific one? |
12:30:37 | arecaceae | Yardanico: thanks |
12:30:43 | dom96 | arecaceae: the one Yardanico linked seems good |
12:31:07 | arecaceae | dom96: thanks |
12:34:25 | Yardanico | eh, I think I should start new reddit account :) |
12:34:38 | Yardanico | because you can't change nickname on reddit |
12:34:55 | Yardanico | dom96, also can you please change Tiberium to Yardanico on nim forum? if that's possible |
12:35:32 | dom96 | I can, but I have to edit the DB which is a pain :\ |
12:36:28 | Yardanico | dom96, ok, that's really not a problem |
12:36:36 | Yardanico | I'll change the avatar on gravatar though |
12:36:47 | couven92 | yaih, I'm back! :) Was the stream good yesterday? |
12:37:06 | Yardanico | couven92, yes, but it was a bit too short :P |
12:37:17 | Yardanico | couven92, we got 70 upvotes on stream announcement on /r/programming |
12:37:27 | couven92 | nice! |
12:37:38 | Yardanico | also we got 160 upvotes on araq's blog post on HN |
12:37:45 | Yardanico | https://news.ycombinator.com/item?id=15512249 |
12:38:05 | arecaceae | dom96: whats your stance on putting something like the asyncproc implementation in the stdlib? |
12:39:25 | couven92 | Oooh... I see it is on YT! :) |
12:39:44 | dom96 | arecaceae: if it's a mature implementation then I'm open to it |
12:39:47 | Yardanico | couven92, wait, already? |
12:39:52 | * | Jesin quit (Quit: Leaving) |
12:39:55 | couven92 | https://www.youtube.com/watch?v=KNUDGZuqfQM |
12:39:56 | Yardanico | I didn't knew that Araq has uploaded it |
12:40:02 | Yardanico | wow |
12:40:12 | arecaceae | dom96: I see, thanks |
12:45:19 | * | claudiuinberlin joined #nim |
12:54:21 | dom96 | hah, somebody submitted the Nim community survey results to Reddit too |
12:59:10 | * | arecaceae quit (Remote host closed the connection) |
12:59:28 | * | arecaceae joined #nim |
13:02:30 | miran | dom96: seems like 'fixing stdlib bugs' is a theme for your today's stream. could you tell us a bit more what can we expect? |
13:08:58 | zolk3ri | yeah, expect stdlib bugs to be fixed |
13:09:02 | zolk3ri | :p |
13:09:33 | zolk3ri | or rather, have no expectations, so you won't feel disappointed when you find that there are no stdlib bugs fixed! |
13:10:40 | dom96 | hehe |
13:10:54 | zolk3ri | (because there are simply no bugs in the stdlib) |
13:11:04 | dom96 | I'll be looking through the list of bugs tagged "stdlib" and seeing what I can fix. |
13:11:20 | * | Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif) |
13:15:47 | miran | just checked 186 of those issues currently :) hopefully after the stream, the number will not go up :D |
13:16:35 | Yardanico | miran, xd |
13:17:18 | * | nhywyll joined #nim |
13:17:33 | Yardanico | dom96, maybe you can also fix documentation bugs :) |
13:20:17 | miran | Yardanico: are there some "low hanging fruits" in the documentation that a nim beginner could help? |
13:20:47 | Yardanico | miran, you can check yourself:) https://github.com/nim-lang/Nim/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3Adocumentation |
13:21:01 | Yardanico | for example https://github.com/nim-lang/Nim/issues/5914 |
13:21:22 | miran | ok, i'll see what i can do - i would really like to get that hacktoberfest t-shirt :) |
13:23:15 | * | endrago__ quit (Remote host closed the connection) |
13:23:29 | dom96 | oh damn, I need to remember to make some more PRs for Hacktoberfest too |
13:25:25 | Yardanico | dom96, https://github.com/AliceWonderland/hacktoberfest :D |
13:25:43 | Yardanico | there's a lot of stuff like |
13:25:44 | Yardanico | https://github.com/Cutwell/Hacktoberfest-Census |
13:25:45 | Yardanico | https://github.com/Nguyen17/Hacktoberfest-Sign-In |
13:26:00 | Yardanico | oh wait |
13:26:08 | Yardanico | You don't need to have a MERGED PR |
13:26:14 | Yardanico | open PRs count too |
13:26:28 | dom96 | Unfortunately people like that will likely cause them to stop this :( |
13:26:32 | Yardanico | yeah |
13:27:46 | miran | PR doesn't have to be merged?! this changes everything! |
13:28:15 | * | Guest72916 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:28:35 | Yardanico | miran, https://hacktoberfest.digitalocean.com/stats/Yardanico |
13:28:46 | Yardanico | My PRs to songbw/admin-server and nimble aren't merged |
13:28:49 | Yardanico | but they count too 0_0 |
13:30:08 | dom96 | yeah, they don't need to be merged |
13:30:51 | miran | well i guess this will be a productive weekend for me.... |
13:33:44 | PMunch | Hmm, what's proxyexe.nim? |
13:34:01 | Yardanico | PMunch, it's a proxy exe for choosenim |
13:34:08 | Yardanico | choosenim creates "fake" nim binaries |
13:34:21 | Yardanico | so it intercepts all nim calls and executes needed nim version |
13:34:53 | PMunch | Hmm |
13:34:53 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:35:20 | * | claudiuinberlin joined #nim |
13:35:28 | PMunch | When I try to compile my project it locks up and Ctrl-C shows the trace coming from that file. But I guess that's just because it started the compiler |
13:38:21 | dom96 | hrm, is that just for your project? |
13:38:54 | dom96 | You can try running the compiler directly, it's in ~/.choosenim/toolchains/nim-ver/bin/nim (replace `ver`) |
13:39:55 | * | claudiuinberlin quit (Client Quit) |
13:40:16 | * | claudiuinberlin joined #nim |
13:40:54 | dom96 | (if you run `choosenim show` it will show you the path) |
13:41:12 | PMunch | Still freezes, but there's no trace this time |
13:41:26 | PMunch | So it wasn't caused by choosenim at least |
13:42:06 | Yardanico | Araq, is there any particular reason why renderer doesn't handle unicode? |
13:42:17 | Yardanico | it's needed for things like this: https://github.com/nim-lang/Nim/issues/3056 |
13:42:52 | * | Ven joined #nim |
13:43:04 | Yardanico | makeNimString in renderer.nim is responsible for this |
13:43:11 | Yardanico | but it handles only ASCII chars via toNimChar |
13:43:15 | * | Ven is now known as Guest33067 |
13:43:25 | Yardanico | not ASCII chars are embedded into the string as-is |
13:54:53 | * | TjYoco joined #nim |
13:55:25 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:56:58 | miran | the thread at HN has just hit 100 comments (and approx. 5 comments about nim :D) |
13:57:02 | * | couven92 quit (Quit: Client disconnecting) |
13:58:23 | dom96 | I offered to answer questions and not a single question, just nice messages :) |
13:59:12 | miran | dom96: you offered that several hours too late, when whole thread went in c++ direction and passed the point of no return :) |
13:59:28 | zolk3ri | eww |
14:00:21 | dom96 | hehe |
14:00:22 | dom96 | true |
14:01:32 | * | claudiuinberlin joined #nim |
14:03:23 | * | PMunch quit (Quit: Leaving) |
14:03:59 | * | Viktor joined #nim |
14:05:58 | * | PMunch joined #nim |
14:06:11 | Viktor | Hey Guys. I was wondering what's the story behind the Nim logo. "King of the programming languages"? |
14:06:28 | * | PMunch quit (Client Quit) |
14:06:40 | * | PMunch joined #nim |
14:06:51 | PMunch | Nim is named after king Nimrod |
14:07:01 | PMunch | That's why it has a crown |
14:07:20 | PMunch | Not entirely sure why it is named after said king though |
14:07:28 | dom96 | Because that was the first king |
14:07:41 | PMunch | The first? |
14:07:47 | * | Guest33067 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:07:59 | Yardanico | PMunch, yes |
14:08:16 | Yardanico | https://en.wikipedia.org/wiki/Nimrod |
14:08:23 | Yardanico | "He was allegedly the first king to wear a crown. " |
14:08:38 | Yardanico | The Syriac Cave of Treasures (ca. 350) contains an account of Nimrod very similar to that in the Kitab al-Magall, except that Nisibis, Edessa and Harran are said to be built by Nimrod when Reu was 50, and that he began his reign as the first king when Reu was 130. |
14:09:04 | Viktor | alright, good to know! |
14:09:12 | Yardanico | Viktor, I think it's a good logo :P |
14:09:37 | dom96 | Something to add to our FAQ |
14:09:43 | Viktor | Yes , it is true, I was just wondering what it means, but now I know. :) |
14:09:55 | Yardanico | https://en.wikipedia.org/wiki/Nimrod |
14:10:01 | PMunch | However: Attempts to match Nimrod with historically attested figures have failed. |
14:10:10 | Yardanico | yes |
14:10:26 | federico3 | therefore a repository of Nimble packages should be called "The Syriac Cave of Treasures" |
14:10:45 | PMunch | A bit long though.. |
14:11:19 | PMunch | Oh wait |
14:11:29 | PMunch | Never mind |
14:11:31 | PMunch | I'm tired |
14:11:34 | PMunch | Time to head home |
14:11:51 | PMunch | https://github.com/PMunch/genui/blob/master/examples/test2.nim#L50 |
14:12:05 | PMunch | Anyone knows why that would make the compiler spin infinitely by the way? |
14:12:23 | dom96 | federico3: awesome idea :) |
14:12:29 | PMunch | https://github.com/PMunch/genui/blob/master/genui/widgets.nim#L54 |
14:12:34 | PMunch | Defined there |
14:13:05 | PMunch | It's not really doing much more than storing a proc in a table, yet it just fails to do anything. Not ever the echo statement is executed |
14:13:24 | dom96 | might want to grab a debug Nim compiler and see what happens with that |
14:14:24 | crem | Is there any SDL-based ui library for nim? Or native ui library, but should work under win,linux and macos. Or html renderer is also fine. :) |
14:14:33 | Yardanico | crem, yep |
14:14:46 | crem | Which of three is yep? |
14:14:47 | Yardanico | crem, best one - https://github.com/yglukhov/nimx |
14:15:04 | Yardanico | sdl, but it aims to have native UIs in the future |
14:15:13 | Yardanico | support win, linux, macos, webgl, android, ios |
14:15:19 | Yardanico | *supports |
14:18:03 | PMunch | dom96, yeah I'll look into that when I get home. Does choosenim have a debug option? |
14:18:04 | crem | Hm.. actually maybe native is not that good for my use case. I'm planning to redo a client for games database site.. Similar to itch.io app (or steam app). itch.io has it in node/electron. I hate javascript, but still seems to be the most viable option. |
14:18:13 | dom96 | PMunch: afraid not |
14:18:48 | Yardanico | crem, SDL is a lot better than electron though |
14:18:54 | Yardanico | crem, I mean performance-wise |
14:19:29 | * | PMunch quit (Quit: Leaving) |
14:19:38 | crem | What about development velocity-wise? |
14:19:56 | * | SusWombat joined #nim |
14:20:00 | * | Jesin joined #nim |
14:20:00 | Yardanico | crem, there are electron bindings for nim |
14:20:09 | Yardanico | https://github.com/PMunch/nim-electron |
14:20:11 | crem | Hm. |
14:20:31 | Yardanico | but it's mostly a PoC I think |
14:20:41 | Yardanico | you can ask PMunch about it though |
14:21:57 | crem | nim+electros is too much to learn at once. What about UI libs on top of SDL, are there? |
14:22:08 | Yardanico | crem, NimX as I said |
14:22:22 | Yardanico | It's built on top of SDL |
14:22:26 | Yardanico | https://github.com/yglukhov/nimx |
14:22:29 | crem | ah, ok. |
14:23:00 | Yardanico | crem, Nimx officially supports Linux, MacOS, Windows, Android, iOS, Javascript (with Nim JS backend) and Asm.js (with Nim C backend and Emscripten). |
14:23:25 | * | Ven_ joined #nim |
14:24:53 | * | miran left #nim (#nim) |
14:25:54 | zolk3ri | Yardanico: oh nice to hear about it |
14:27:10 | Yardanico | If anyone missed: dom96 is streaming at 16:00 UTC (4 PM) |
14:27:13 | Yardanico | 1.5 hours from now! |
14:27:26 | zolk3ri | 18+? |
14:27:36 | Yardanico | zolk3ri, I don't think so xD |
14:27:44 | Yardanico | it's 0+ |
14:27:44 | zolk3ri | shiet |
14:27:46 | zolk3ri | :p |
14:27:51 | Yardanico | zolk3ri, how old are u ? |
14:27:55 | zolk3ri | 23 |
14:28:05 | Yardanico | dom96, almost 60 votes on strawpoll |
14:29:36 | zolk3ri | Yardanico: what's that "FPS: 1"? xD |
14:29:47 | Yardanico | zolk3ri, it's actually very good |
14:29:56 | Yardanico | it means that GUI doesn't update if there's no events |
14:30:03 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:30:03 | Yardanico | that means that CPU and GPU aren't wasted |
14:30:08 | zolk3ri | ah right |
14:30:21 | Yardanico | there's webgl demo: http://yglukhov.github.io/nimx/livedemo/main.html |
14:30:30 | * | claudiuinberlin joined #nim |
14:30:51 | * | claudiuinberlin quit (Client Quit) |
14:31:11 | dom96 | Yardanico: yay, nice |
14:31:29 | Yardanico | zolk3ri, pure-nim, as you can see: http://yglukhov.github.io/nimx/livedemo/main.js |
14:31:52 | zolk3ri | Yardanico: yeah I think I will use this, my friend wanted me to write an app for Tesco that he could use on his phone, and if I write it, it will become popular in poland tescos! |
14:33:04 | Yardanico | dom96, nim community seems to be very hard-core :P |
14:33:07 | Yardanico | only low-level(ish) stuff |
14:33:16 | Yardanico | stdlib/compiler/destructors |
14:33:37 | dom96 | zolk3ri: ooh, what's the app? |
14:33:44 | dom96 | (or is top secret? :)) |
14:34:26 | dom96 | *is it |
14:36:37 | zolk3ri | dom96: it's really easy, just need a properly designed UI to find products and their EAN-13... and possibly even generate it, it should prioritize frequently viewed products and whatnot, have a photo gallery, etc. I will have to fetch the products from ezakupy.tesco.pl before though :P |
14:36:47 | zolk3ri | what they currently have is apparently a nightmare |
14:37:03 | zolk3ri | and takes lots of time to navigate through, and buggy |
14:37:55 | dom96 | Cool. Will it work with the UK tesco? :) |
14:38:17 | zolk3ri | possibly :P |
14:39:03 | * | TjYoco quit (Quit: Leaving) |
14:44:37 | * | claudiuinberlin joined #nim |
14:52:50 | Araq | has dom96 started already? |
14:53:04 | Yardanico | Araq, no |
14:53:12 | dom96 | in a little over an hour |
14:53:22 | Yardanico | Araq, yeah, he'll fix stdlib bugs :P |
14:53:30 | Araq | er huh? shouldn't it be in 7 minutes? |
14:53:33 | Yardanico | Araq, http://www.strawpoll.me/14185591 |
14:53:36 | Yardanico | Araq, no |
14:53:38 | Yardanico | 16:00 UTC |
14:53:47 | Yardanico | 4pm |
14:57:39 | * | d10n-work joined #nim |
14:57:40 | dom96 | Araq: Did you set up auto hosting? |
14:58:18 | Araq | what's that? |
14:58:41 | * | zolk3ri quit (Ping timeout: 248 seconds) |
14:58:54 | dom96 | When I go live and you're not live then your channel will automatically host my livestream |
14:59:00 | dom96 | I set it up for your channel on mine |
14:59:03 | * | zolk3ri joined #nim |
15:00:00 | Yardanico | Araq, go to https://www.twitch.tv/settings/channel, there's "Host List" - add d0m96 here and enable "Auto host" |
15:00:32 | zolk3ri | when it begins, can I have a link so I can watch? :P |
15:00:32 | * | PMunch joined #nim |
15:01:02 | Yardanico | zolk3ri, https://go.twitch.tv/d0m96 |
15:01:06 | Araq | Yardanico, ok thanks |
15:01:07 | gokr | Hum, gitter all quiet. But here its a party. |
15:01:10 | zolk3ri | thanks |
15:01:25 | Araq | gokr, uh oh, did the bridge die? |
15:01:34 | gokr | It must have. |
15:01:37 | Yardanico | yeah |
15:01:46 | dom96 | oprypin: bridge seems to be dead |
15:02:01 | Yardanico | * FromGitter has quit (Ping timeout: 258 seconds) it happened 15:08 my time, 12:08 UTC |
15:02:07 | Yardanico | lol |
15:02:17 | dom96 | :\ |
15:02:19 | zolk3ri | oh |
15:02:32 | * | miran joined #nim |
15:02:50 | gokr | But it can't be written in Nim then, right? :) |
15:03:35 | dom96 | indeed |
15:03:39 | dom96 | Time to rewrite in Nim |
15:03:47 | zolk3ri | it should be easy! |
15:04:07 | Yardanico | if gitter has an API - yes |
15:04:16 | dom96 | Just port oprypin's code |
15:04:17 | Yardanico | https://developer.gitter.im/docs/welcome |
15:04:19 | dom96 | Should be trivial |
15:04:22 | Yardanico | dom96, ? |
15:04:47 | dom96 | https://github.com/oprypin/critter |
15:07:11 | * | solitudesf joined #nim |
15:08:17 | * | nsf quit (Quit: WeeChat 1.9) |
15:08:31 | gokr | PMunch: About genui and DSL for UIs, did you look at Red? Since they are all about DSLs, might have some good input. Also, how does genui relate to Nimui? |
15:08:33 | livcd | fromgitter is in which language ? |
15:08:42 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:08:44 | Yardanico | livcd, crystal |
15:09:33 | Yardanico | probably I would port it to Nim :P |
15:09:47 | livcd | awww lets not bash crystal :P |
15:09:52 | gokr | PMunch: I mean... not Nimui, Nigui |
15:10:00 | Yardanico | livcd, nah! |
15:10:06 | Yardanico | we need our own critter |
15:10:10 | Yardanico | "girelay" |
15:10:24 | Yardanico | G(it)I(RC)relay |
15:10:29 | Yardanico | G(itter)I(RC)relay |
15:10:32 | livcd | call it |
15:10:34 | livcd | Nimoy |
15:10:36 | Yardanico | LOL |
15:10:43 | Yardanico | do you know what does it mean in russian? |
15:11:02 | livcd | nope but i was referring to leonard nimoy |
15:11:02 | livcd | heh |
15:11:09 | PMunch | gokr, Yeah I did have a look at red a while back |
15:11:23 | Yardanico | "nimoy" is like "nemoy", it means "voiceless" |
15:11:27 | Yardanico | "немой" |
15:11:28 | PMunch | Might have too look at it more closely |
15:11:48 | * | Ven_ quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:11:58 | Yardanico | or it means "mute" |
15:12:08 | livcd | Yardanico: ah i am a slavic speaker myself but i would not make that connection |
15:12:09 | livcd | :) |
15:12:13 | Yardanico | livcd, well why? : ) |
15:12:23 | gokr | PMunch: I only know Red ... from perusing Rebol/Red as inspiration for Spry in some areas. Some stuff in there looks darn nice at least. |
15:12:37 | Yardanico | livcd, and believe it or not |
15:12:39 | Yardanico | livcd, https://github.com/evacchi/nimoy |
15:12:49 | livcd | Yardanico: i guess because the root of the word would be for me "NEM" :D |
15:13:38 | miran | "nemoj" in croatian would mean "don't" |
15:13:38 | zolk3ri | Yardanico: I bet you are coding in nim wearing full adidas tracksuit, aren't you?! |
15:13:50 | Yardanico | zolk3ri, xd |
15:14:07 | Yardanico | zolk3ri, I'm not a gopnik |
15:14:30 | zolk3ri | :P |
15:14:36 | Yardanico | LOL, there's a wiki page |
15:14:37 | Yardanico | https://en.wikipedia.org/wiki/Gopnik |
15:15:25 | livcd | zolk3ri: yes and just like perelman he would refuse a 1m$ because he understands the universe :P |
15:15:32 | PMunch | And how do they relate is a bit involved. I first created a macro for wxnim called genui. It had a simple DSL for creating wxWidgets Nim code. Then I figured that wxWidgets was a bit clumsy to use for Linux only applications and I made genui for Gtk2 and Gtk3. Then NiGui appeared and I decided that I wanted to try and get first-class support for genui into it as it wasn't always that easy to create the DSL after the fact. Through doing all this I kept thinking |
15:15:32 | PMunch | that maybe there's another way and that's what I'm trying to achieve with the currently (and very confusingly named) genui project. It will focus on creating native GUI code with very little abstraction so that you can still implement special features in platform specific code if you want to. All this of course while focusing on having a good clean DSL. |
15:15:46 | PMunch | Whoops, didn't realise how much I typed.. |
15:21:00 | * | Andris_zbx left #nim ("Leaving") |
15:28:15 | * | Guest17 joined #nim |
15:28:58 | * | Guest17 left #nim (#nim) |
15:29:43 | * | zenAudio joined #nim |
15:32:25 | gokr | PMunch: :) |
15:33:05 | * | nhywyll quit (Quit: nhywyll) |
15:33:22 | * | nhywyll joined #nim |
15:34:11 | * | couven92 joined #nim |
15:35:46 | Araq | PMunch, want some DSL advice? |
15:35:54 | PMunch | Always :) |
15:36:25 | Araq | uses karax's DLS :-) |
15:36:33 | Araq | *DSL |
15:36:46 | Araq | what's wrong with it? I spent some time designing it |
15:37:14 | Araq | it's really a DSL for tree construction and UIs are widget trees, so to speak |
15:37:24 | PMunch | Hmm, good point |
15:37:32 | PMunch | The Karax DSL is pretty good |
15:38:16 | gokr | Several cross platform abstractions in the Smalltalk community has used an "internal" tree representation, and then used platform specific "builders" that take that tree as input. |
15:38:38 | PMunch | And I do wonder how you do the mix between your widgets and Nim code |
15:39:32 | * | Arrrr joined #nim |
15:39:32 | * | Arrrr quit (Changing host) |
15:39:32 | * | Arrrr joined #nim |
15:39:57 | Araq | it's called "fairy dust" |
15:40:43 | PMunch | That's what I feared :P |
15:40:56 | PMunch | At least it's not Vodoo |
15:41:06 | PMunch | Voodoo* |
15:41:39 | Araq | well I got a PR fixing a bug in it so that's proof others can understand it |
15:42:39 | PMunch | Haha, good point |
15:42:51 | * | dandevelo joined #nim |
15:49:21 | couven92 | how far along is parallel testament? |
15:49:50 | Yardanico | Araq, yeah, add parallel testament to your next topic list |
15:49:59 | Arrrr | What do you think https://www.reddit.com/r/programming/comments/77ko76/nim_pointer_free_programming/domzpon/ |
15:50:20 | Yardanico | rust is even harder at this lol |
15:50:44 | couven92 | Yardanico, I actually have a quite substatial PR for testament coming up... I am considering of just doing parallel testament |
15:51:20 | Yardanico | couven92, there's already a PR for parallel testament |
15:51:29 | Arrrr | i guess we always have crystal for GC |
15:51:31 | couven92 | Yeah, I know... |
15:51:31 | Araq | couven92, oh yeah thanks for reminding me |
15:51:32 | zolk3ri | rust is way more difficult, I agree |
15:51:46 | zolk3ri | but calling nim difficult? I don't know... |
15:52:05 | dom96 | I actually agree with shevegen's point. |
15:52:27 | dom96 | My main opposition to Araq's plan is that Nim may become more difficult. |
15:52:40 | zolk3ri | yeah, I'm not up to date with these plans anyway |
15:52:41 | couven92 | Araq, yeah but my PR is still waiting for me to do the HTML output using templates as dom96 suggested... it's in my backlog, I just haven't gotten around to doing that... I was planning on doing that now... |
15:53:07 | livcd | dom96: i agree and disagree at the same time |
15:53:26 | Araq | couven92, go ahead and do not wait for parallel testament |
15:53:45 | couven92 | maybe do parallel testament afterwards! :P |
15:53:48 | couven92 | ? |
15:53:50 | Araq | that other PR uses the wrong solution |
15:53:54 | Araq | (sorry!) |
15:54:05 | dom96 | https://go.twitch.tv/d0m96 |
15:54:07 | couven92 | yeah, I also had something else in mind |
15:54:07 | Araq | it's much easier to parallelize testament anyway |
15:54:08 | dom96 | Stream is starting soon |
15:54:25 | Araq | except it's blocked by a bug in osproc that I need to fix first |
15:54:35 | Yardanico | dom96, dat chat |
15:54:37 | Yardanico | :D |
15:54:47 | dom96 | Beautiful am I right? |
15:54:53 | Yardanico | yeah, |
15:55:59 | couven92 | Araq, I was thinking of doing a lock on the output json file by just doing a line append. then the parallel SQL acces won't be an issue anymore, and then we'd rid ourselves from the SQLite DB |
15:56:24 | Araq | just remove the Sqlite code already, it's not hard |
15:56:34 | couven92 | Yeah will do |
15:56:38 | dom96 | weird that the view counter is at 0 |
15:56:41 | couven92 | :) templates first though |
15:56:51 | dom96 | and just as I say it, it changes :) |
15:57:01 | couven92 | dom96, in my window it says 325 |
15:57:23 | dom96 | That's past viewers I guess? |
15:57:32 | couven92 | ah, sorry that was the total view count |
15:57:45 | livcd | i see 4 viewers |
15:58:05 | federico3 | perhaps the time of the day is not ideal? |
15:58:24 | livcd | it's still US business hours no ? |
15:58:24 | dom96 | oh? Why not? |
15:58:45 | dom96 | oh well, too late to change now :) |
15:58:49 | livcd | ah yeah |
15:58:55 | livcd | it's too early for US |
15:59:29 | couven92 | dom96, yeah, we know that you're based in the UK, we can deal, always possible to rewatch on YT later |
15:59:42 | Yardanico | my time is already 17:00 |
15:59:53 | Yardanico | sorry |
15:59:54 | Yardanico | 19:00 |
15:59:57 | Arrrr | lol |
16:00:09 | FromTwitch | <couven92> here it's 18:00 |
16:00:11 | FromTwitch | <couven92> :) |
16:00:13 | livcd | you thought 7 pm right ? :) |
16:00:24 | Yardanico | european part of russia |
16:00:32 | FromTwitch | <araq4k> it is |
16:02:05 | FromTwitch | <araq4k> can I send some issues here? |
16:03:11 | FromTwitch | <araq4k> https://github.com/nim-lang/Nim/issues/782 |
16:03:37 | FromTwitch | <araq4k> https://github.com/nim-lang/Nim/issues/4405 |
16:03:58 | FromTwitch | <araq4k> ok, sorry |
16:04:21 | FromTwitch | <araq4k> https://github.com/nim-lang/Nim/issues/6386 |
16:05:00 | FromTwitch | <araq4k> https://github.com/nim-lang/Nim/pull/6514 |
16:06:00 | FromTwitch | <araq4k> +1 |
16:07:08 | FromTwitch | <araq4k> keep in mind the tester uses re.nim, so you probably need to update it too |
16:07:10 | miran | dom96: zoom in please (Ctrl+=), my traditional request |
16:07:33 | FromTwitch | <araq4k> what 're' uses + reExtended |
16:07:41 | miran | much better, thanks! |
16:08:32 | FromTwitch | <araq4k> I misunderstood your question then |
16:08:37 | FromTwitch | <araq4k> yes! |
16:08:40 | * | claudiuinberlin joined #nim |
16:08:54 | FromTwitch | <araq4k> yes |
16:10:00 | FromTwitch | <araq4k> result = re(s, flags) # implementation |
16:11:04 | FromTwitch | <araq4k> keep in mind the tester uses re.nim , so you probably need to update it too |
16:11:09 | * | zenAudio quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:11:25 | couven92 | Araq, why do you like the explicit result-assignment better? Just curious (I have no real preference) |
16:12:00 | FromTwitch | <araq4k> @couven92 lag here, I proposed this code before he typed it |
16:12:10 | couven92 | ah? |
16:12:14 | couven92 | I see :) |
16:12:26 | * | claudiuinberlin quit (Client Quit) |
16:13:25 | FromTwitch | <araq4k> ok, never mind, the tester is ok |
16:13:32 | livcd | araq4k: but you still prefer your way no ? |
16:13:52 | couven92 | Yardanico, because of your bridge, I can log out of the Twitch IRC, right? |
16:14:39 | couven92 | because I'm annoyingly getting highlighted there all the time :P |
16:15:07 | couven92 | dom96, yeah he answered the question |
16:15:28 | FromTwitch | <araq4k> @livcd: not sure, 'result' predates implicit returns and my style hasn't kept up |
16:15:30 | Viktor | does anyone know if the postgres module is supporting JSON fields in query response? |
16:15:36 | PMunch | couven92, yeah you can only be in this room if you like :) |
16:16:10 | couven92 | yaih |
16:16:22 | * | kafke quit () |
16:16:42 | dandevelo | Is there any way to detect a value is not part of an enum? |
16:17:23 | FromTwitch | <araq4k> @viktor: the db_postgre module supports every datatype but returns it as string |
16:17:38 | * | claudiuinberlin joined #nim |
16:17:39 | * | claudiuinberlin quit (Client Quit) |
16:18:08 | federico3 | that's really unexpected tho |
16:18:20 | couven92 | dom96, only react to the stuff where you get highlighted so that you can concentrate on the stream |
16:18:24 | federico3 | dom96: I am |
16:18:27 | Viktor | hmm ok, so I will have to manually convert it, ok! |
16:18:35 | * | derlafff quit (Remote host closed the connection) |
16:18:47 | FromTwitch | <araq4k> shouldn't it raise an OS error? |
16:19:15 | federico3 | dom96: say you want to expand `~`, log out what you get and then go and create a file |
16:19:29 | federico3 | that's a pretty typical usecase |
16:19:33 | couven92 | dandevelo, you can easily find out by assigning it to an enum variable |
16:20:09 | dandevelo | couven92 how would the check look like? |
16:20:51 | federico3 | dom96: nah you are expanding "../myconfigfile.json" or "~/conf.json" |
16:21:05 | * | Arrrr quit (Ping timeout: 240 seconds) |
16:21:38 | FromTwitch | <yardanico> I'm finally here |
16:22:21 | couven92 | dandevelo: https://gist.github.com/53539056cc3a02eaca4086c644ca14af |
16:22:32 | FromTwitch | <yardanico> LOL |
16:22:34 | FromTwitch | <yardanico> Aporia!? |
16:23:16 | couven92 | dom96, you can run F5 in vscode |
16:23:32 | FromTwitch | <yardanico> F6 |
16:23:43 | FromTwitch | <yardanico> @d0m96 you can use F6 to compile & run current nim file in vscode btw |
16:23:52 | couven92 | (you just have to create a launch.json and set the file to execute to ${file}) |
16:24:06 | FromTwitch | <yardanico> you don't need to edit launch.json |
16:24:12 | FromTwitch | <yardanico> it works without it |
16:24:27 | dandevelo | couven92: agree that blows up but how do you detect that in order to report it back to another function? |
16:24:32 | FromTwitch | <yardanico> I use F6 0_0 |
16:24:54 | couven92 | dom96, yes |
16:25:07 | couven92 | dandevelo, try, catch block |
16:25:29 | * | Viktor quit (Ping timeout: 260 seconds) |
16:25:46 | FromTwitch | <araq4k> dom96: I agree, that file "save as " dialog is super annoying, stupid osx |
16:25:49 | miran | can't you just run it with ctrl+alt+n? (if you have code runner plugin) |
16:25:53 | couven92 | dom96, I'll do a feature request for that in the vscode nim extension |
16:26:26 | FromTwitch | <manterolat> You might need to tell VSCode it's a Nim file, rather than Plain Text (bottom right)? |
16:26:28 | couven92 | the Python extension does that, I agree it would be nice to have for Nim |
16:26:33 | zolk3ri | dom96: just use emacs or vim |
16:26:35 | zolk3ri | :P |
16:27:44 | * | kobi7 joined #nim |
16:27:49 | livcd | guys dont make him context switch too much |
16:28:19 | dandevelo | couven92: try, catch block does not seem to work |
16:28:41 | couven92 | dandevelo, I am sorry? You want to not blow up? You know assigning two toally disperate types won't and SHOULD never work! |
16:29:01 | couven92 | numeric and enum types are totally disperate! |
16:29:47 | dandevelo | couven92: just saying that try except does not have any effect |
16:29:54 | dandevelo | except never gets called |
16:30:08 | * | FromGitter joined #nim |
16:30:15 | FromTwitch | <pyloor> in vscode open new file (Untitled-1), paste your code, switch to "Nim" on bottom right and then press F6. Works for me. It creates a /tmp/vscodenimdirty.nim file and then compile+runs it. |
16:30:16 | couven92 | yeah I know, it does not compile |
16:30:42 | couven92 | dandevelo: ^ |
16:31:09 | FromTwitch | <yardanico> she wants to learn nim |
16:31:30 | couven92 | :D |
16:31:43 | FromTwitch | <araq4k> no |
16:31:49 | FromTwitch | <yardanico> use dirty one |
16:31:50 | FromGitter | <mratsim> @Yardanico, did you workaround the Gitter<->IRC issue with your twitch bot? it’s really weird on Gitter |
16:32:01 | Yardanico | what do you mean? |
16:32:22 | darkn0de | $150 bounty posted on https://github.com/nim-lang/Nim/issues/782 |
16:32:27 | FromGitter | <mratsim> ah no, we just get “fromTwitch" |
16:32:37 | gokr | dandevelo: You need to distinguish between compilation error and runtime exceptions. |
16:32:47 | couven92 | Araq, can you explain what immediate and dirty do? |
16:32:49 | couven92 | :O |
16:33:14 | Araq | couven92, not now. |
16:33:27 | couven92 | okay, I'll look it up later |
16:33:52 | * | Viktor joined #nim |
16:34:32 | zolk3ri | which issue is he trying to fix? |
16:35:09 | zolk3ri | thanks! |
16:35:19 | darkn0de | zolk3ri, what do you mean. I think both cert and name verifications |
16:35:43 | zolk3ri | darkn0de: meant this: https://github.com/nim-lang/Nim/issues/6386 |
16:35:48 | FromTwitch | <yardanico> he's talking with dom96 on stream :) |
16:35:49 | darkn0de | I think CN verifications might already be in there (probably need tests) |
16:35:55 | Yardanico | darkn0de, https://go.twitch.tv/d0m96 |
16:35:58 | darkn0de | zolk3ri, ah :) sorry |
16:36:03 | couven92 | zolk3ri, https://github.com/nim-lang/Nim/issues/6386 |
16:36:54 | darkn0de | Yardanico, thank you! |
16:37:04 | FromGitter | <Yardanico> @mratsim well I can't fix now until I'll create Gitter-IRC-Twitch bridge myself :P |
16:37:12 | couven92 | dom96, you want to do whatever the client wants you to do, meaning evaluate the Connection request header |
16:37:41 | FromGitter | <mratsim> I think that should be tagged RFC: https://github.com/nim-lang/Nim/issues/6538 |
16:37:52 | Yardanico | one sec |
16:38:06 | Yardanico | but we all know what would happen to that issue :P |
16:38:14 | dandevelo | @gokr: maybe this link gives you an idea on what I am trying to accomplish: https://www.pastiebin.com/59ea264f91fa1 |
16:38:18 | FromGitter | <mratsim> :D |
16:38:59 | couven92 | dom96, yes you're right HTTP 1.1 is keep-alive by default when the COnnection header is missing |
16:39:25 | miran | Yardanico: can you put 'bounty' label on #782? |
16:39:36 | federico3 | dom96: netcat is your friend |
16:39:40 | Yardanico | miran, yep |
16:39:40 | * | Arrrr joined #nim |
16:39:40 | * | Arrrr quit (Changing host) |
16:39:40 | * | Arrrr joined #nim |
16:39:59 | couven92 | dom96, google closed the connection because it did not encounter an HTTP version |
16:40:18 | couven92 | so try google with an invalid ULR |
16:40:18 | dandevelo | couven92 is this what you had in mind with the try/except? https://www.pastiebin.com/59ea264f91fa1 |
16:40:59 | FromTwitch | <araq4k> btw I'm away |
16:41:25 | couven92 | dandevelo, ah! You want to parse a string into an enum? |
16:41:32 | couven92 | or rather tryParse? |
16:41:51 | Yardanico | enum to string it seems |
16:42:34 | FromGitter | <mratsim> @dandevelo, wow you’ve been on this for 4 hours? Shouldn’t this be a runtime exception: https://play.nim-lang.org/?gist=1a4ab384324fcadcdcd1d946f158a23c |
16:42:41 | Yardanico | it is |
16:42:44 | Yardanico | only in debug mode |
16:42:49 | Yardanico | in release it would pass |
16:43:41 | Yardanico | and result would contain !(invalid data) |
16:43:45 | Yardanico | e.g. invalid enum value |
16:43:48 | darkn0de | Miran, Yardanico looks complex |
16:44:11 | * | SunDwarf is now known as abc |
16:44:13 | * | abc is now known as SunDwarf |
16:44:19 | dandevelo | Yep, that is the output: 3 (invalid data!) |
16:44:25 | couven92 | dom96 teaching HTTP at UiT |
16:44:31 | couven92 | for the last three years |
16:44:34 | couven92 | :P |
16:45:07 | dandevelo | couvent92: more like...trying to see if an uint32 value is part of an enum |
16:45:12 | FromTwitch | <lorymaster> Just so you know, every browser does whatever it wants in response to http messages, so it probably is not that big of a deal if you do whatever you want |
16:45:14 | Arrrr | you can do this: Create a const set with every value in your enum then check with "is v in set" |
16:45:19 | federico3 | why closing the connection tho? |
16:45:37 | couven92 | Yes dom96! Always keep-alive by default (unless 500 status code) |
16:45:54 | Yardanico | maybe we should add "contains" for enums? |
16:46:09 | Yardanico | and make it a compiler magic :P |
16:46:15 | couven92 | the reason why google closed the connection was that you did not do an HTTP reuqest at all! |
16:46:19 | federico3 | most servers and client have been ignoring HTTP RFCs and keeping connection opens more aggressively |
16:46:37 | dandevelo | Yardanico: that would be great :) |
16:46:37 | couven92 | try Google with a syntactically correct but invalid request for example |
16:46:50 | Arrrr | mm no it doesn't work ... |
16:46:58 | Arrrr | YEs, there should be a contains for enums, and len too |
16:47:12 | federico3 | dom96: BTW telnet injects extra character while netcat does not |
16:47:33 | PMunch | From RFC 2616: "A significant difference between HTTP/1.1 and earlier versions of HTTP is that persistent connections are the default behavior of any HTTP connection. That is, unless otherwise indicated, the client SHOULD assume that the server will maintain a persistent connection, even after error responses from the server." |
16:47:44 | PMunch | So basically it should persist if it is able to |
16:47:55 | PMunch | Obviously if the server crashes there isn't much to be done |
16:47:56 | zolk3ri | if the "Connection" is close, then you close, and if it's keep-alive, you don't, and HTTP/1.1 defaults to persistent connections, allowing multiple requests and responses to be carried over a single connection |
16:48:09 | zolk3ri | https://tools.ietf.org/html/rfc7230#section-6.3 |
16:48:17 | zolk3ri | https://tools.ietf.org/html/rfc7230#page-79 |
16:48:30 | FromTwitch | <yardanico> maybe we need to change the title to "fixing asynchttpserver bugs" ? :) |
16:49:03 | couven92 | PMunch, yes I didn't feel for quoting, but that was exactly the text that went through my head :P |
16:49:10 | FromTwitch | <yardanico> @d0m96 why you don't have an extension for indentation lines? |
16:49:40 | * | bkerin joined #nim |
16:49:42 | FromTwitch | <yardanico> to show indent levels |
16:50:01 | couven92 | years of teaching INF2301 have caused me to basically memorize the HTTP RFC :P |
16:50:34 | * | derlafff joined #nim |
16:51:51 | dandevelo | @mratsim: yep, after 4 hours it looks like the answer is: not possible yet |
16:52:32 | miran | Yardanico: you don't need extension for that, just enable it in vscode options |
16:52:40 | Yardanico | miran, yeah I actually know |
16:52:45 | Yardanico | I forgot it's a vscode feature :P |
16:52:51 | PMunch | couven92, I just have mad Google-fu :P |
16:54:17 | FromTwitch | <meebhus> hi! what language are we working with? |
16:54:32 | Yardanico | meebhus: Nim |
16:54:40 | Yardanico | https://nim-lang.org |
16:55:10 | FromTwitch | <meebhus> thanks |
16:55:25 | * | JappleAck quit (Quit: Leaving) |
16:55:40 | couven92 | dom96, you SHOULD evaluate the "Connection" Request header!!!! |
16:55:51 | couven92 | to decide whether to close or not!! |
16:56:08 | zolk3ri | yeah, and if it's not present, default to keep-alive if it's HTTP/1.1 |
16:56:43 | * | Viktor82 joined #nim |
16:57:04 | couven92 | very good dom96! I am appeased! :) |
16:57:57 | * | Viktor82_ joined #nim |
16:58:20 | federico3 | we need a confcall instead of twitch |
16:58:44 | Yardanico | skype? |
16:58:48 | Yardanico | discord? |
16:58:53 | federico3 | mumble? |
16:58:57 | * | Viktor quit (Ping timeout: 260 seconds) |
17:00:57 | * | Viktor82 quit (Ping timeout: 240 seconds) |
17:01:12 | * | bkerin quit (Quit: ircII EPIC5-1.1.10 -- Are we there yet?) |
17:03:15 | FromTwitch | <yardanico> oh wait |
17:03:25 | FromTwitch | <yardanico> c-c-c-converter in stdlib ?! :) |
17:04:44 | federico3 | we don't |
17:04:57 | * | Viktor82_ quit (Ping timeout: 240 seconds) |
17:10:08 | * | bkerin joined #nim |
17:10:31 | kobi7 | hi |
17:11:27 | * | TjYoco joined #nim |
17:12:14 | * | cynofox joined #nim |
17:13:56 | FromTwitch | <yardanico> @d0m96 you already use waitFor here |
17:14:01 | FromTwitch | <yardanico> yeah |
17:14:21 | FromTwitch | <yardanico> resp.body needs to be awaited (or waitFor'ed) too |
17:16:20 | * | bkerin quit (Quit: "Woman with bleached blonde hair have black hair by cracky.") |
17:16:56 | kobi7 | Hi Yardanico |
17:17:00 | Yardanico | kobi7, hi |
17:17:50 | kobi7 | I am not sure how it works, as I haven't done much low level coding: |
17:18:19 | kobi7 | I wonder if I can get the memory bytes of a variable holding some object. |
17:18:48 | kobi7 | most of my experience is with c# |
17:18:54 | * | bkerin joined #nim |
17:19:06 | Yardanico | kobi7, you can do that |
17:19:32 | kobi7 | for example, for deep clone, or deep equal. instead of using reflection, I want to get the bytes, then sort of cast them to that type |
17:19:57 | Yardanico | kobi7, you don't need bytes for that |
17:20:10 | Yardanico | let mynewobj = cast[MyNewObject](myoldobjectvar) |
17:20:24 | * | bkerin quit (Client Quit) |
17:20:34 | Yardanico | kobi7, for equal you can just overwrite == |
17:20:34 | kobi7 | but that just changes the reference type |
17:20:44 | * | bkerin joined #nim |
17:21:30 | Yardanico | kobi7, so why would you need to get raw object bytes? |
17:22:15 | kobi7 | actually my thinking is wrong, as I'd need new variables to point to that copied data |
17:22:33 | kobi7 | an object with complex fields inside, clone it fully. |
17:22:52 | Yardanico | nim already has value semantics for simple objects |
17:23:11 | Yardanico | if you have ref object, you can access its' object like that "myvar[]" |
17:24:14 | kobi7 | myvar[] ? |
17:24:33 | FromTwitch | <bad_hombres> the only issue I have is that it's not done in go |
17:24:40 | Yardanico | yes, you would dereference your reference with that |
17:24:49 | Yardanico | so you would access it's data |
17:25:08 | kobi7 | I see. |
17:25:31 | kobi7 | but the variables it has inside it, would still be ref objects |
17:25:48 | kobi7 | and I'd need to mimic the structure. so again working recursively ... |
17:25:51 | FromTwitch | <bad_hombres> because go rules and other languages drool |
17:25:59 | kobi7 | in c# it'd be done with reflection but that is really awful to do |
17:25:59 | FromTwitch | <bad_hombres> and it's easy to read |
17:26:20 | FromTwitch | <bad_hombres> see, it's infallible logic |
17:26:31 | FromTwitch | <bad_hombres> you can't argue with it |
17:27:22 | Yardanico | well nim is faster than go :) |
17:27:47 | FromTwitch | <bad_hombres> premature performance optimization is the root of all evil |
17:27:48 | FromTwitch | <boys_in_the_hod> what are you programming? |
17:28:09 | Yardanico | bad_hombres: and nim is compiled to efficient native binaries |
17:28:34 | FromTwitch | <bad_hombres> same with go |
17:28:50 | kobi7 | we congratulate you, and hope to cooperate by porting go libs to nim :) |
17:28:57 | FromTwitch | <bad_hombres> I'm also just a huge shit talker |
17:29:09 | federico3 | this is really off topic to the streaming and not productive |
17:29:12 | Yardanico | bad_hombres: let's not go into offtopic too much |
17:29:13 | kobi7 | there is no competition here |
17:29:14 | FromTwitch | <bad_hombres> ppsshhh generics |
17:29:24 | FromTwitch | <bad_hombres> who needs them |
17:29:35 | zolk3ri | lol go |
17:29:44 | kobi7 | oh, am i disturbing some twitch time? |
17:30:01 | * | Guest17 joined #nim |
17:30:17 | kobi7 | federico3: where can I watch the streaming? |
17:30:27 | federico3 | kobi7: https://go.twitch.tv/d0m96 |
17:30:29 | FromTwitch | <boys_in_the_hod> what is in your opinion the easiest language to learn for beginners? |
17:30:39 | Yardanico | python |
17:30:43 | kobi7 | ah, sorry didn't know |
17:30:47 | FromTwitch | <bad_hombres> I'm serious here, I actually hate exceptions |
17:31:00 | FromTwitch | <yardanico> @bad_hombres we all already know that you're just a troll :P |
17:31:02 | FromTwitch | <bad_hombres> it's just a frustrating thing for me, I don't like try/catch |
17:31:40 | FromTwitch | <bad_hombres> and then you have to wrap the code in a try catch and that indents your code more |
17:31:58 | * | Guest17 quit (Client Quit) |
17:32:02 | FromTwitch | <yardanico> and with go you need to have a shit-ton of these ugly if data, ok = ... |
17:32:22 | FromTwitch | <bad_hombres> yeah I don't have an issue with that |
17:32:27 | zolk3ri | 19:30:39 < Yardanico> python |
17:32:29 | FromTwitch | <bad_hombres> not saying exceptions are wrong |
17:32:30 | zolk3ri | not anymore, it's nim |
17:32:31 | zolk3ri | shh |
17:32:32 | FromTwitch | <bad_hombres> just that I don't like it |
17:32:43 | FromTwitch | <bad_hombres> entirely subjective |
17:32:47 | kobi7 | improve error messages? |
17:32:48 | * | Viktor joined #nim |
17:32:49 | FromTwitch | <yardanico> @bad_hombres well this stream is about nim :) |
17:33:01 | miran | zolk3ri: let's not exaggerate that much ;) |
17:33:26 | zolk3ri | well, I wouldn't want anyone to start with python, tbh |
17:33:32 | zolk3ri | start with C :p |
17:33:47 | Yardanico | I've started with python |
17:33:50 | Arrrr | start with the geeks |
17:33:51 | Yardanico | after that nim |
17:34:05 | FromTwitch | <bad_hombres> just start programming |
17:34:17 | FromTwitch | <bad_hombres> once you learn a few languages its easy to pick up another |
17:34:25 | zolk3ri | I've started working on an ioquake3 game, that's how I got into programming |
17:34:42 | miran | zolk3ri: why don't you think people should start with python? what has changed? |
17:34:50 | FromTwitch | <bad_hombres> all languages are hard with little experience |
17:35:14 | FromGitter | <mratsim> @dandevelo use tables it will work, they have the `contains`or `haskey` procs |
17:35:17 | couven92 | dom96, review https://github.com/nim-lang/Nim/pull/6051 |
17:35:20 | zolk3ri | bad_hombres, well, depends... even if you know C, Haskell might not seem too intuitive :P |
17:35:20 | couven92 | :P |
17:36:05 | zolk3ri | miran: Oh they can start with any language they would like, I don't mind :) Personally I just dislike Python. |
17:36:23 | miran | zolk3ri: ok, but why do you dislike it? |
17:36:29 | FromTwitch | <bad_hombres> of course there are exceptions, it's more of a general statement |
17:37:07 | FromTwitch | <bad_hombres> I guess I should have wrapped my previous statement in a try/catch |
17:37:16 | Arrrr | lol |
17:37:34 | FromTwitch | <yardanico> @bad_hombres one gott thing with try/except: you don't have to wrap EVERY call which can throw an error into a try/catch |
17:37:56 | FromTwitch | <yardanico> *good |
17:39:16 | couven92 | that one was SIMPLE! :) |
17:39:48 | bkerin | everyone should start with C |
17:39:50 | FromTwitch | <yardanico> @d0m96 there's already a PR to fix that |
17:39:56 | FromTwitch | <yardanico> @d0m96 check the issue again |
17:39:58 | bkerin | then they actually know what other languages are doing |
17:40:12 | * | Guest17 joined #nim |
17:40:15 | FromTwitch | <bad_hombres> bkerin by that logic, everyone should start with assembly |
17:40:16 | FromGitter | <mratsim> everyone should start with Haskell @bkering ;) |
17:40:20 | bkerin | nah |
17:40:21 | FromTwitch | <bad_hombres> then they'll know what C is doing |
17:40:22 | zolk3ri | miran: performance, dynamic typing, indentation significant syntax, too many ways supported to do a thing, but i gotta run brb |
17:40:29 | bkerin | C is close enough to assembly its easy to see the map |
17:40:46 | bkerin | should know what assembly is and look at once but no need to program in |
17:41:08 | FromGitter | <RSDuck> I think it depends on what you want to do |
17:41:21 | FromTwitch | <bad_hombres> i don't think everyone needs to know what assembly is doing |
17:41:28 | FromTwitch | <bad_hombres> there are just so many layers these days |
17:41:33 | FromTwitch | <bad_hombres> front end devs for example |
17:42:59 | FromTwitch | <yardanico> @d0m96 maybe you've pasted these lines and client sent them one-by-one? |
17:43:17 | FromTwitch | <yardanico> ok |
17:43:27 | * | Viktor quit (Ping timeout: 248 seconds) |
17:43:54 | bkerin | well I started with eiffel first weirdly, and thinking objects were magic was bad overall I think |
17:45:30 | couven92 | Araq, Yardanico maybe open and reserve #nim-stream for streams in the future? |
17:45:38 | Yardanico | couven92, yeah I was talking about that too |
17:45:43 | Yardanico | but gitter is a problem |
17:46:04 | couven92 | dom96, there is no RFC limit on Content-Length |
17:46:26 | couven92 | because that is ALWAYS very specific to your sever and application! |
17:46:33 | * | Viktor joined #nim |
17:46:48 | FromTwitch | <yardanico> default limit for PHP is 8388608 |
17:47:04 | FromTwitch | <yardanico> it can be more though |
17:47:48 | couven92 | also be careful! I can put non-numeric or larger than 64-bit int values into Content-Length! |
17:49:17 | * | smt joined #nim |
17:49:44 | FromTwitch | <yardanico> @d0m96 probably we would need to split processRequest into separate procs/templates so one proc will parse http version, other one will parse path etc... |
17:49:50 | FromTwitch | <yardanico> because it's TOO large |
17:49:59 | FromTwitch | <yardanico> like god methods in java |
17:50:08 | FromTwitch | <yardanico> or in every other language |
17:50:26 | FromTwitch | <yardanico> @d0m96 use templates :P |
17:51:23 | * | Viktor quit (Remote host closed the connection) |
17:52:25 | FromTwitch | <yardanico> @d0m96 try it with very big int |
17:52:29 | FromTwitch | <yardanico> @d0m96 like 121929512951929512951929512951925912 |
17:52:32 | FromTwitch | <yardanico> would it still error? |
17:53:15 | FromTwitch | <yardanico> xD |
17:53:31 | oprypin | Yardanico, gitter is a problem only from having two bots going at once, the messages going there from twitch look atrocious with the double prefix |
17:53:44 | oprypin | but if u want another bridge pair, that's very easy |
17:54:01 | Yardanico | oprypin, I've added a special case for FromGitter on Twitch btw |
17:54:22 | Yardanico | oprypin, yeah, can you please also forward all gitter messages to #nim-stream ? :) |
17:54:53 | oprypin | wait how does that work, wouldn't you need a separate gitter room as well? |
17:55:24 | * | bkerin quit (Quit: Visit http://lice.muppetz.com) |
17:55:46 | oprypin | you'd get out of context messages all the time |
17:55:50 | Yardanico | oprypin, well yeah we need to ask dom96 |
17:56:04 | FromTwitch | <yardanico> @d0m96 can you please create another room in nim-lang gitter? |
17:56:06 | FromTwitch | <yardanico> for streams |
17:57:09 | * | TjYoco quit (Quit: Leaving) |
17:57:51 | FromTwitch | <yardanico> mget |
17:58:04 | oprypin | yardanico, is twitch just IRC or what |
17:58:11 | Yardanico | oprypin, just irc |
17:58:17 | Yardanico | oprypin, https://github.com/Yardanico/twitchrelay |
18:00:16 | * | Trustable quit (Remote host closed the connection) |
18:00:39 | * | Guest17 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:02:03 | * | Guest17 joined #nim |
18:03:58 | * | Guest17 quit (Client Quit) |
18:04:43 | * | Guest17 joined #nim |
18:06:20 | * | cynofox_ joined #nim |
18:06:41 | * | kobi7 quit (Ping timeout: 240 seconds) |
18:09:12 | * | cynofox quit (Ping timeout: 258 seconds) |
18:10:48 | * | cynofox_ quit (Ping timeout: 246 seconds) |
18:11:48 | * | nhywyll quit (Quit: nhywyll) |
18:12:22 | * | cynofox__ joined #nim |
18:14:39 | * | JappleAck joined #nim |
18:17:33 | * | Guest17 quit (Quit: Textual IRC Client: www.textualapp.com) |
18:21:51 | * | endragor quit (Ping timeout: 258 seconds) |
18:22:23 | couven92 | I cannot export procs in a templ file? |
18:23:13 | couven92 | why does nim say: "testamenthtml.templ(13, 25) Error: 'export' is only allowed at top level" :( |
18:23:28 | Yardanico | couven92, :( |
18:24:03 | Yardanico | and I'm making gitter-irc bridge in nim :P |
18:24:20 | Yardanico | thankfully gitter has a very nice streaming api (like long polling) |
18:24:39 | oprypin | you dont know what you're signing up for |
18:24:48 | Yardanico | oprypin, I know it's not easy |
18:24:52 | Yardanico | all these corner cases |
18:25:04 | Yardanico | oprypin, does your crystal bot uses async or threads? |
18:25:07 | oprypin | you think my bot fails for no reason |
18:25:16 | Yardanico | oprypin, let me guess |
18:25:19 | Yardanico | gitter api ? |
18:25:21 | oprypin | like once in 3 months a new kind of weird socket error comes up |
18:25:26 | Yardanico | oh |
18:25:36 | Yardanico | I had a lot of issues like that with VK long polling |
18:25:38 | oprypin | gitter goes down sometimes |
18:25:43 | Yardanico | here: https://github.com/VKBots/VBot |
18:25:51 | Yardanico | (I don't develop it anymore) |
18:25:57 | oprypin | and like not fully down but some different error every time |
18:30:32 | * | zolk3ri quit (Ping timeout: 260 seconds) |
18:31:40 | * | zolk3ri joined #nim |
18:47:19 | * | claudiuinberlin joined #nim |
18:53:07 | Yardanico | dom96, eh, we can't do this with our current httpclient :( https://github.com/oprypin/critter/blob/master/gitter.cr#L110 |
18:53:33 | Yardanico | basically our httpclient just reads ALL available data until request is complete |
18:53:43 | dom96 | nope, it doesn't |
18:53:54 | dom96 | This is where .bodyStream comes in |
18:53:58 | Yardanico | yeah I've tried it |
18:54:00 | dom96 | See how `body` is implemented |
18:54:17 | dom96 | if using that doesn't work then we have a bug on our hands :) |
18:54:43 | couven92 | can someone who knows Source Code filters (templating files) help me: https://github.com/couven92/Nim/tree/testament-devel/tests/testament |
18:55:08 | couven92 | I have created the testamenthtml.templ and including it in htmlgen.nim |
18:55:39 | couven92 | but nim complains that I am calling the proc in testamenthtml.templ |
18:55:57 | couven92 | > htmlgen.nim(27, 10) Error: attempting to call undeclared routine: 'generateHtmlTabListItem' |
18:58:03 | * | sleepyqt quit (Quit: Leaving) |
18:58:15 | dom96 | Where is the endproc for generateHtmlTabListBegin? (https://github.com/couven92/Nim/blob/testament-devel/tests/testament/testamenthtml.templ#L146 just above) |
18:58:32 | Yardanico | yeah |
18:58:39 | Yardanico | these templates aren't indentation based |
18:58:44 | couven92 | dom96, endproc????? |
18:58:45 | Yardanico | docs mention this |
18:58:47 | Yardanico | couven92, yes |
18:58:51 | dom96 | #endproc |
18:58:58 | couven92 | ah! |
18:59:07 | couven92 | okay, let me try |
18:59:08 | Yardanico | Because indentation-based parsing is not suited for a templating engine, control flow statements need end X delimiters |
18:59:31 | Yardanico | and you can even use export then |
18:59:34 | Yardanico | * |
18:59:52 | couven92 | hmm... https://nim-lang.org/docs/filters.html did say that :( |
18:59:57 | Yardanico | yes |
19:02:37 | Yardanico | dom96, so I firstly use "request" and then read bodyStream? |
19:03:15 | dom96 | Yardanico: yeah, that should work. |
19:03:23 | dom96 | Never tried it though so it might not :) |
19:03:27 | couven92 | dom96, Yardanico: now I get `testamenthtml.templ(144, 5) Error: undeclared identifier: 'endproc'` |
19:03:37 | dom96 | couven92: #end proc (maybe) |
19:03:45 | Yardanico | couven92, yeah^ |
19:03:48 | Yardanico | as docs say, end X |
19:03:50 | Yardanico | not endX |
19:04:35 | Yardanico | dom96, it doesn't work it seems :( |
19:04:57 | * | Arrrr quit (Read error: Connection reset by peer) |
19:05:50 | * | bkerin joined #nim |
19:06:28 | Yardanico | maybe I'm doing it wrong, IDK |
19:07:29 | couven92 | Yardanico, dom96: end proc works, but does not do anything. I still get the original error in htmlgen.nim |
19:07:34 | Yardanico | hmm |
19:07:50 | dom96 | maybe you're missing some more #end proc |
19:07:52 | couven92 | and exporting with * does not work at all |
19:07:53 | dom96 | or some other #end x |
19:08:05 | dom96 | Yardanico: Up for investigating the problem? :) |
19:08:10 | Yardanico | dom96, yeah I'm trying to |
19:08:19 | dom96 | great |
19:09:59 | Yardanico | dom96, basically while true loop in httpclient.nim at line 991 doesn't break |
19:10:12 | Yardanico | because gitter sends message in json and \r |
19:10:16 | * | cynofox joined #nim |
19:10:16 | Yardanico | not \c\L |
19:11:49 | dom96 | it should reach line 1042, where it reads the body |
19:11:57 | * | cynofox__ quit (Ping timeout: 240 seconds) |
19:12:10 | dom96 | What does Gitter actually send? |
19:12:13 | dom96 | Like all the content |
19:12:47 | oprypin | http keepalive with \r-separated jsons |
19:13:11 | Yardanico | dom96, https://developer.gitter.im/docs/streaming-api |
19:13:15 | Yardanico | The JSON stream returns messages as JSON objects that are delimited by carriage return (\r). Newline characters (\n) may occur in messages, but carriage returns should not. |
19:13:46 | dom96 | Yeah, but tell me the raw data that the Gitter servers send once you send a HTTP request to whatever the URL is |
19:14:26 | oprypin | {"a": "b"}\r{"a": "b"}\r\r\r{"a": "c"} |
19:14:37 | oprypin | with variable waits after each \r |
19:14:54 | Yardanico | so firstly it just sends some http stuff |
19:14:55 | dom96 | You're just giving me the body |
19:15:00 | dom96 | I'm interested in the HTTP headers |
19:15:07 | Yardanico | ok |
19:15:12 | oprypin | i dont have them ready but i never use those |
19:15:30 | Yardanico | dom96, https://gist.github.com/Yardanico/7a042bf55895a7cb763a03c72ebd52b6 |
19:16:13 | * | Vladar quit (Remote host closed the connection) |
19:16:15 | oprypin | i mean i dont exactly feel great about my bot being replaced for no reason but whatever |
19:16:32 | Yardanico | well I don't really want to replace it |
19:16:35 | Yardanico | at least I want to write it :P |
19:17:06 | dom96 | and then presumably after that it sends \c\l\c\l, right? |
19:17:26 | Yardanico | yeah, it sends one \13\10 which is \c\l (AFAIK) |
19:17:31 | dom96 | or well, just an empty line |
19:17:43 | dom96 | so httpclient should break at line 1003 |
19:17:47 | dom96 | Is it really not doing that? |
19:18:21 | Yardanico | yeah it did it, but then it still runs |
19:18:21 | Yardanico | hmm |
19:18:36 | dom96 | That's impossible since it breaks :) |
19:22:03 | Yardanico | dom96, so if I ctrl+c it shows that it's running parseChunks at line 903 |
19:22:34 | dom96 | that's probably where the bug is |
19:22:44 | dom96 | echo chunkSizeStr |
19:23:35 | Yardanico | dom96, so if gitter answers with some event - it's something like 219 or 211, if there's no events - 2 |
19:23:57 | Yardanico | dom96, but still |
19:24:17 | Yardanico | parseChunks will run until they parse ALL response body, no? |
19:24:28 | dom96 | nope, it's async |
19:24:33 | dom96 | What's your code? |
19:24:48 | Yardanico | well I've tried async firstly, and then sync one |
19:24:52 | Yardanico | I'm using sync one |
19:24:59 | Yardanico | and basically client.request doesn't return at all |
19:25:07 | dom96 | well... use async one |
19:25:12 | Yardanico | it would be the same, no? |
19:25:15 | dom96 | no |
19:25:33 | Yardanico | dom96, should I await client.request? |
19:25:38 | dom96 | although hrm |
19:25:48 | Yardanico | I will need to await or read it anyway |
19:26:12 | dom96 | Try changing line 1042: 'await' -> 'asyncCheck' |
19:27:12 | Yardanico | dom96, compile-time error: got (void), but expected one of: proc asyncCheck[T](future: Future[T]) |
19:27:22 | Yardanico | and yes, I'm using async version now |
19:27:31 | Yardanico | ah |
19:28:12 | couven92 | okay dom96, Yardanico, got it to work :) https://github.com/nim-lang/Nim/pull/6058 is now ready to merge and will bring beatiful testament HTML :) |
19:28:24 | dom96 | Yardanico: might need a when in there |
19:28:35 | Yardanico | dom96, yeah I've added asyncCheck to "else" after when statement |
19:31:06 | * | zayu joined #nim |
19:31:07 | * | cynofox quit (Read error: Connection reset by peer) |
19:31:37 | zayu | Hi, quick and simple question: I have an old version of the nim compiler and want to update it. How do I do that? |
19:31:48 | * | cynofox joined #nim |
19:31:59 | PMunch | zayu, uninstall and install choosenim |
19:32:13 | PMunch | After that you can use it to switch between versions :) |
19:32:16 | zayu | I see, thanks |
19:32:18 | dom96 | (or if you've installed Nim via choosenim just run `choosenim update stable`) |
19:32:33 | zayu | No I cloned it |
19:32:34 | PMunch | Yeah of course |
19:32:54 | PMunch | What version by the way? |
19:32:56 | PMunch | Just for fun |
19:33:11 | zayu | Sec will check |
19:33:14 | Yardanico | dom96, well should I set a callback to bodyStream to receive data? |
19:33:42 | zayu | nim version 0.15.3 |
19:33:55 | Yardanico | zayu, cd yournimrepodir |
19:33:56 | Yardanico | git pull |
19:33:59 | Yardanico | nim c koch |
19:34:01 | PMunch | Oh wow, yeah that's pretty old |
19:34:04 | Yardanico | ./koch boot -d:release |
19:34:08 | Yardanico | ./koch tools |
19:34:10 | zayu | Very old! |
19:34:10 | Yardanico | but this may fail |
19:34:24 | zayu | It's all good, I'll go for choosenim |
19:34:41 | zayu | Seems like stack for Haskell which is quite nice |
19:34:48 | zayu | Thanks for the input guys, much appreciated! |
19:34:55 | PMunch | No problem :) |
19:35:04 | Yardanico | zayu, but remove your existing nim installation first |
19:35:11 | Yardanico | otherwise you may encounter some very strange issues |
19:35:27 | zayu | Yeah, no worries. I'll remove it from path and stuff |
19:36:01 | Yardanico | dom96, I'll give you the code now |
19:36:24 | dom96 | do it the same as `body` |
19:36:29 | dom96 | bbl |
19:37:47 | * | RPG joined #nim |
19:38:11 | * | RPG is now known as Guest58559 |
19:40:00 | Yardanico | dom96, yeah, indeed asyncCheck solves this problem |
19:50:14 | Yardanico | dom96, but I don't think it should work that way anyway |
19:50:26 | Yardanico | because sync code wouldn't for example be able to read bodystream at all |
19:50:33 | Yardanico | since parseBody will still block it |
19:50:36 | * | dandevelo quit (Remote host closed the connection) |
19:51:03 | * | themagician joined #nim |
20:07:32 | * | zayu quit (Quit: Page closed) |
20:07:37 | dom96 | yes, well, for sync code you'd need to use another thread anyway |
20:08:12 | bkerin | hi guys |
20:08:37 | bkerin | somewhere in docs I ran accross a list of different gc options you could specify but I don't remember where and now can't find |
20:10:00 | Yardanico | bkerin, one sec |
20:10:11 | Yardanico | dom96, it's strange though |
20:10:20 | Yardanico | ruby allows you to do that in one thread it seems |
20:10:37 | Yardanico | dom96, https://github.com/gitterHQ/gitter-ruby-stream/blob/master/gitter-stream.rb |
20:10:54 | Yardanico | probably it's because they use third-party package :P |
20:11:08 | bkerin | ah theres a --gc option in the compiler manual |
20:11:18 | bkerin | kinda mysterious what the options mean though |
20:11:24 | Yardanico | bkerin, why? |
20:11:30 | Yardanico | you just choose needed GC |
20:12:08 | bkerin | well not sure what v2 go regions mean for example, and the other ones are not too specific about what goes on either |
20:12:24 | Yardanico | bkerin, well then just use default gc :) |
20:12:54 | bkerin | what I'm actually wondering is if there's a way to make gc immediate, st when var goes out of scope its destructor runs right away |
20:13:15 | Yardanico | bkerin, hmm, IDK about that, you can ask Araq |
20:14:16 | bkerin | seems like nim has almost all needed to do db-backed types pretty easily, but requiring .delete() or something whenever anything goes out of scope or accepting that db gets out of sync both seem somewhat undesirable |
20:17:10 | Araq | bkerin, you can use a withDb template for that |
20:18:24 | Araq | or do what all the cool kids are doing, use experimental features (destructors) and complain when it doesn't work ;-) |
20:18:51 | bkerin | not sure what you mean by withDb template |
20:19:55 | bkerin | I'm inclined towards destructors but like I said it would be nice if they ran immediately when a var goes out of scope, so accessible vars and existing db rows stay in sync for a db-backed type |
20:21:57 | Yardanico | bkerin, they will |
20:22:01 | Yardanico | with new destructors :) |
20:22:24 | Yardanico | because destroyer compiler pass will inject destructor calls into AST |
20:22:39 | bkerin | o nice |
20:22:53 | bkerin | so no need even to pick markAndSweep collector in particular |
20:22:58 | bkerin | er |
20:23:02 | bkerin | ref counting i mean |
20:23:04 | Yardanico | bkerin, https://nim-lang.org/araq/destructors.html |
20:23:42 | Araq | Yardanico, well let's not sell an unfinished feature yet. |
20:25:00 | Yardanico | Araq, but you'll finish it, wouldn't you ? :) |
20:25:22 | Yardanico | I think these destructors can be actually useful in many contexts |
20:25:38 | bkerin | yah please im in kind of a hurry here :) |
20:26:06 | Yardanico | bkerin, you can already *try* new destructors, but it's very-very-very experimental |
20:26:36 | Yardanico | bkerin, https://github.com/nim-lang/Nim/blob/devel/tests/destructor/tcustomseqs.nim |
20:26:42 | bkerin | fair warning thx |
20:27:15 | bkerin | Araq i'm curious what you envision by withDb() if a brief summary is possible? |
20:29:03 | * | MadHatter_ joined #nim |
20:29:44 | Araq | https://nim-lang.org/docs/tut2.html#templates |
20:29:53 | Araq | template withFile example |
20:30:48 | couven92 | Araq, here you go: https://github.com/nim-lang/Nim/pull/6058 |
20:31:02 | couven92 | nice pretty testament HTML noe done! :) |
20:31:14 | couven92 | s/noe/now/^ |
20:31:23 | Yardanico | couven92, how does it look ?:) |
20:31:26 | Yardanico | now |
20:31:37 | * | cynofox quit (Quit: -a- IRC for Android 2.1.35) |
20:31:43 | Yardanico | ah, the same? |
20:31:51 | Yardanico | you just reworked it to use filters? |
20:31:57 | MadHatter_ | Hi guys! How it goes? |
20:32:01 | couven92 | Yardanico, yes |
20:32:07 | Yardanico | MadHatter_, hi! |
20:32:09 | couven92 | MadHatter_: Hi there! :) |
20:33:15 | MadHatter_ | I'm a bit in trouble here :( |
20:33:35 | MadHatter_ | I'm pretty sure someone got into this before, but I didn't find solution yet |
20:33:42 | Yardanico | MadHatter_, what's your problem? |
20:33:57 | MadHatter_ | postgres C api connect just hangs and does nothing when it cannot find database host |
20:34:51 | Yardanico | MadHatter_, are you about https://github.com/nim-lang/Nim/blob/master/lib/impure/db_postgres.nim#L503 ? |
20:34:57 | MadHatter_ | I think I need to wrap db connect into async procedure and wait for timeout, but can't figure out what this proc would need to get work |
20:35:24 | MadHatter_ | Yardanico, yep and low-level too |
20:35:41 | Yardanico | MadHatter_, well this proc will throw an error if it can't connect |
20:36:25 | * | nitely joined #nim |
20:36:35 | couven92 | what does `^1` do again? |
20:36:51 | miran | similar to python's -1 |
20:37:01 | miran | indexing from the right side |
20:37:29 | couven92 | okay, so Mystring[^1] gives me the last character? |
20:37:32 | MadHatter_ | Yardanico, unfortunately it doesn't, because low-level API hangs |
20:37:37 | miran | couven92: yep |
20:37:45 | Yardanico | MadHatter_, well there's no way to solve that |
20:37:55 | Yardanico | you wouldn't be able to solve it using async |
20:38:01 | Yardanico | because this call will just block forever |
20:38:04 | Yardanico | if C api hangs |
20:38:12 | Yardanico | you should probably try updating your postgresql |
20:38:19 | Yardanico | because it's a bug in postgresql then |
20:39:44 | MadHatter_ | well this is bad news, because it's freshly installed libpq for alpine |
20:40:53 | Yardanico | MadHatter_, but really you can't solve that, because it's not an issue from nim side. you can however try to connect in another thread, and wait if it successes in the main thread |
20:41:00 | Yardanico | but this would be a hack |
20:41:39 | * | nitely quit (Quit: Page closed) |
20:42:28 | * | HoloIRCUser3 joined #nim |
20:43:01 | * | HoloIRCUser3 is now known as nitely |
20:44:01 | MadHatter_ | agreed, but this is also a solution |
20:44:50 | * | miran quit (Ping timeout: 255 seconds) |
20:46:25 | Yardanico | dom96, merge https://github.com/nim-lang/Nim/pull/6051 ? :) couven92 explained why ^1 can't be used here |
20:47:32 | * | gokr quit (Ping timeout: 255 seconds) |
20:48:07 | Araq | these align* procs all need to move to unicode.nim |
20:48:23 | couven92 | Araq, ah, right, I remember :P |
20:48:28 | Araq | (and be made utf-8 aware) |
20:48:45 | couven92 | that was why I went on this unicode crusade last time :D |
20:50:11 | couven92 | Araq, so https://github.com/nim-lang/Nim/pull/6301 then? |
20:51:48 | * | gokr joined #nim |
20:52:17 | Araq | couven92, clean up this PR please |
20:52:26 | Araq | only the unicode related changes please |
20:53:09 | Yardanico | Araq, what about https://github.com/nim-lang/Nim/issues/3056? the problem is that renderer.nim doesn't handle unicode at all |
20:54:03 | Araq | Yardanico, easy to fix, just make it escape only \0..\31 as well as invalid UTF-8 |
20:54:12 | Yardanico | Araq, ok |
20:55:06 | couven92 | Araq, I don't understand waht you mean... do you mean the strutils changes? sure, I can remove them out of this |
20:55:17 | Araq | yes |
20:57:19 | Yardanico | Araq, wait, then "for i in countup(0, len(s)-1): add(result, toNimChar(s[i]))" needs to be changed to user utf8 iterator, right? |
20:57:27 | Yardanico | hm, I'll try without it first |
20:58:07 | Araq | that iterator likely doesn't do what you want |
20:58:33 | Yardanico | Araq, ah, yeah, I don't need it probably |
21:00:00 | * | PMunch quit (Quit: leaving) |
21:00:27 | * | gokr quit (Ping timeout: 240 seconds) |
21:01:24 | * | MadHatter_ quit (Ping timeout: 260 seconds) |
21:02:08 | shashlick | Araq's live streams are not getting archived on twitch |
21:02:23 | Yardanico | shashlick, yes |
21:02:24 | * | oky joined #nim |
21:02:28 | Yardanico | they're on youtube |
21:02:33 | couven92 | Araq, okay cleaned up as you asked. CI running |
21:02:35 | shashlick | Timing just doesn't work from the US to watch live |
21:02:39 | shashlick | Oh that's great |
21:02:50 | Yardanico | shashlick, https://www.youtube.com/channel/UCAIXKsgiEkRjwlNgduABgmw |
21:02:59 | couven92 | Yardanico, yeah I subscribed and belled Araq's YT :) |
21:03:52 | shashlick | Yardanico: thanks! |
21:04:11 | Yardanico | Araq, should I import unicode module and check if result string is invalid in makeNimString? because if I would do validateUtf8 on stringified char in toNimChar - it's going to fail |
21:08:46 | Yardanico | ah nvm |
21:08:57 | Araq | copy the algorithm from validateUtf8 and adapt it to your needs |
21:09:45 | Araq | libraries are overrated, diy works better :P |
21:10:33 | Yardanico | Araq, well I can embed validateUtf8 into makeNimString |
21:10:45 | Araq | yes |
21:11:41 | * | gokr joined #nim |
21:13:08 | dom96 | Yardanico: Did you get it working? |
21:13:16 | Yardanico | dom96, yes, I did |
21:13:20 | Yardanico | are you about gitter? |
21:13:26 | dom96 | yeah |
21:13:31 | Yardanico | but I couldn't figure a way to run it without "while true" loop :P |
21:13:40 | Yardanico | callbacks are hell here |
21:13:45 | dom96 | Show me the code :) |
21:14:03 | Yardanico | dom96, working one or with callbacks? |
21:14:49 | dom96 | I want to help you with the callbacks |
21:17:45 | * | MadHatter_ joined #nim |
21:18:56 | MadHatter_ | Hi guys again, my problem with libpq is somewhat resolved by switching on ubuntu. So this is definitely a bug with alpine's libpq |
21:19:57 | * | solitudesf quit (Ping timeout: 240 seconds) |
21:21:35 | dom96 | Yardanico: So you're trying to avoid 'while true' by using callbacks? |
21:21:41 | Yardanico | dom96, yes |
21:21:47 | dom96 | You don't need to go so far, one callback is fine |
21:22:03 | dom96 | But you can make it '{.async.}' and use 'await' inside it. |
21:22:17 | dom96 | let final = await streamFut.read() |
21:22:34 | * | claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com) |
21:22:52 | dom96 | Also, I don't think you need to check for 'finished' |
21:23:59 | Yardanico | dom96, it seems I can't use {.async.} here :( |
21:24:15 | dom96 | why? |
21:24:23 | Yardanico | maybe you didn't notice - I'm setting a callback for a FutureStream, not for a Future |
21:27:37 | dom96 | You'll need the while true then |
21:27:58 | dom96 | sadly |
21:28:15 | * | NimBot joined #nim |
21:28:38 | dom96 | It would be nice if we could get an iterator for FutureStream |
21:28:55 | * | MadHatter_ quit (Quit: Page closed) |
21:29:11 | Yardanico | !eval #?braces\r\necho "hi" |
21:29:12 | NimBot | Compile failed: Error: invalid directive: '\' |
21:30:58 | dom96 | bah, I need to learn how to deal with journalctl |
21:32:10 | federico3 | dom96: -f to follow, -u <unit> to filter by unit, --identifier <id..> to filter by name... |
21:32:42 | dom96 | federico3: What's the easiest way to find output around where the process terminated? |
21:33:26 | federico3 | do you know the name of the process? |
21:33:46 | dom96 | yep |
21:33:59 | federico3 | start with sudo journalctl --since today | grep fooo -C10 just to take a look |
21:34:26 | FromGitter | <Yardanico> asdasd |
21:34:31 | Yardanico | oh, wrong chat, sry |
21:34:36 | dom96 | federico3: That gave a lot of output |
21:35:04 | dom96 | but it did narrow it down |
21:35:06 | federico3 | sudo journalctl --since today will run in a pager, type '/' to search |
21:35:18 | dom96 | didn't run in a pager :) |
21:35:28 | federico3 | it should |
21:35:42 | federico3 | without '| grep ..' |
21:35:58 | dom96 | oh, that's what you mean |
21:36:05 | dom96 | yeah, well I found it anyway |
21:36:09 | dom96 | "out of memory" :\ |
21:36:16 | Yardanico | dom96, lol |
21:36:24 | FromGitter | <watzon> Hmm question. While digging through the code in another repo I found this: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ What does `magic` do and why can't I find any documentation for it? [https://gitter.im/nim-lang/Nim?at=59ea6c5832e080696e070ace] |
21:36:26 | Yardanico | btw it can happen if you've casted something wrongly |
21:36:43 | Yardanico | watzon: it means that this magic is implemented in this repo |
21:36:47 | Yardanico | or in library it uses |
21:36:51 | Yardanico | do you have the link? |
21:37:00 | Yardanico | this "magic" is probably a macro |
21:37:02 | Yardanico | or a template |
21:37:57 | FromGitter | <watzon> Here's a link to the version I forked. The original version doesn't build with nimble so I had to fix it https://github.com/watzon/telebot.nim/blob/master/private/api.nim |
21:38:22 | Yardanico | watzon: https://github.com/watzon/telebot.nim/blob/master/private/utils.nim#L155 |
21:38:57 | FromGitter | <watzon> I found it |
21:39:05 | FromGitter | <watzon> I thought it might have been built in |
21:39:07 | dom96 | Yardanico: Pretty sure it's a GC issue :\ |
21:39:11 | * | nsf joined #nim |
21:39:14 | Yardanico | dom96, gc safety? |
21:39:24 | dom96 | no, the GC is leaking memory |
21:39:33 | dom96 | either that or an async bug |
21:39:38 | Yardanico | watzon: you can inspect the resulting output of this macro |
21:39:47 | Yardanico | just add "echo result.toStrLit" at the end of it |
21:40:06 | FromGitter | <watzon> Thank you for that Yardanico |
21:41:29 | * | NimBot joined #nim |
21:42:12 | dom96 | yeah, that's pretty bad |
21:42:21 | dom96 | It rises every time I refresh IRC logs |
21:43:05 | Araq | dom96, there are no known GC leaks. there is apparently an issue with memory fragmentation |
21:43:51 | dom96 | I'm going to see if I can reproduce locally |
21:43:59 | Araq | but that's the memory allocator, not the GC :P |
21:44:05 | watzon | Follow up question, this time from IRC because Gitter annoys me. I am getting the error `unhandled exception: SSL support is not available. Cannot connect over SSL.`. Do I have to do something special to rebuild Nim with SSL support? I may have not had openSSL installed when I built it |
21:44:17 | dom96 | watzon: yep, rebuild with -d:ssl |
21:44:26 | Yardanico | watzon, add -d:ssl to compiler command |
21:44:29 | watzon | Thanks :) |
21:44:42 | Yardanico | and also you need openssl lib (not dev version) |
21:44:49 | Yardanico | well dev will work too |
21:44:58 | couven92 | Araq, I am venturing further into testament source code... I suggest replacing the SQLite database with an append-only JSON file |
21:45:14 | couven92 | that will be much easier to deal with for parallel testament |
21:46:27 | darkn0de | hi couven92, which project is this? and how to you plan to do json as append only? |
21:47:09 | darkn0de | sqlite does lock for writes (but not reads), but append-only might end up with partial writes-while-reading with multiple readers |
21:47:27 | Araq | couven92, too complex just create different .json files |
21:47:49 | couven92 | ah, a new one for each run |
21:48:05 | darkn0de | never mind :) |
21:48:08 | couven92 | darkn0de, this is testament, the Nim Tester |
21:48:12 | darkn0de | oh cool. |
21:48:37 | darkn0de | i wish there was a good way to do appends to json without rewriting the whole file. |
21:48:46 | darkn0de | you can do it with log files, csv files.. why not json |
21:49:05 | couven92 | darkn0de, It's the thing that makes the GitHub CI builds turn red from time to time, mostly because running it causes build timeouts |
21:49:21 | darkn0de | ahh I see |
21:49:26 | couven92 | darkn0de, yeah I know how to do parallel log dumping |
21:49:28 | dom96 | darkn0de: why can't you do it with json? |
21:49:33 | bkerin | bye guys thx for help |
21:49:50 | * | NimBot1 quit (Remote host closed the connection) |
21:49:51 | darkn0de | dom96, i'm saying you can't really append to a json file after writing it. |
21:49:55 | * | bkerin quit (Quit: Confucius say: Man who lay woman on hill not on level.) |
21:50:11 | darkn0de | dom96, you really just have to write a new file and atomically rename |
21:50:11 | dom96 | darkn0de: You can have a file which contains multiple json objects, one per line :) |
21:50:28 | darkn0de | dom96, that's not a single json doc anymore then |
21:50:42 | couven92 | dom96, darkn0de, Araq: point is: with JSON if you have an array at the roor, you can just blindly remove the last character (the closing bracket) and replace it with new array items |
21:51:07 | couven92 | s/roor/root/^ |
21:51:28 | darkn0de | couven92, agreed, but that's kinda blindly writing. if you do two writes at same time, bad things happen ;) |
21:51:38 | darkn0de | couven92, you could od it easily with yaml though |
21:51:48 | darkn0de | because there's no closing characters |
21:52:36 | Araq | json is better than xml. but still pretty bad :- |
21:52:52 | couven92 | darkn0de, yeah, the system uses a global variable for the db right now... in theory there's no real difference to my approach. But I remember that Araq wanted to rid testament of the SQLite dependency |
21:52:53 | darkn0de | definitely |
21:53:06 | darkn0de | couven92, that makes sense |
21:53:32 | darkn0de | but sqlite does give you nice write lock guarantees. of course, if you don't have multiple writers, then it doesn't really matter. |
21:54:17 | darkn0de | anyway sorry for taking the convo off track ;) |
21:54:49 | * | Trustable joined #nim |
21:55:12 | couven92 | Araq, what did you mean by just creating different json files? A new one for each time I run testament? |
21:55:30 | dom96 | Araq: Yep, I can reproduce it. How do I investigate? |
21:59:17 | Yardanico | darkn0de, that's fine |
21:59:26 | Yardanico | on-topic off-topic is acceptable here :P |
21:59:33 | Yardanico | *relevant off-topic |
22:00:06 | darkn0de | cool ;) |
22:02:59 | watzon | Is there a good way to include a local package as a dependency for testing? Something like npm's link option |
22:03:17 | Yardanico | watzon, yeah |
22:03:21 | Yardanico | run "nimble develop" |
22:03:28 | Yardanico | in the folder with the package |
22:03:47 | Yardanico | so if you import your package somewhere, version from this dir will be used |
22:04:05 | watzon | Ah perfect |
22:04:18 | watzon | Thanks again Yardanico. You the real MVP |
22:05:03 | couven92 | Yardanico, that is actually imensly helpful! :O |
22:05:06 | couven92 | Nice! :) |
22:06:14 | Yardanico | couven92, well I just keep an eye on new libraries/changes in nim ecosystem :P |
22:06:22 | couven92 | :) |
22:07:02 | * | d10n-work quit (Quit: Connection closed for inactivity) |
22:07:33 | darkn0de | Yardanico, that's awesome - does that make sense if you're compiling a static binary as well, or not really matter since they'll get embedded anyway? |
22:08:45 | Yardanico | darkn0de, are you about OpenSSL ? |
22:09:04 | Yardanico | it doesn't statically link by default, but you can do it of course |
22:09:07 | Yardanico | *linked |
22:14:28 | * | Jesin quit (Quit: Leaving) |
22:14:30 | dom96 | Sounds like Nim could use a "This week/month in Nim" newsletter :) |
22:14:36 | * | themagician quit () |
22:17:59 | gokr | dom96: Random question - can Jester do long polls? |
22:18:23 | dom96 | gokr: yes, but I haven't tested it extensively |
22:18:48 | gokr | Ok, because I have a need for that in Arduinobot. |
22:19:27 | gokr | Clients submit compilation jobs - and right now, they have to poll on a URL for the compilation result to get done. |
22:19:29 | * | Trustable quit (Remote host closed the connection) |
22:20:42 | gokr | The MQTT API that Arduinobot also has is better in that regard, you "emulate" a request/response by having the client subscribe to a specific result topic, where the server will publish the result. So no polling needed. |
22:21:12 | gokr | But it would be neat perhaps to try a long request for the HTTP endpoint.- |
22:21:45 | watzon | Any easy way to take an Object and turn it into a JsonNode? |
22:21:50 | gokr | dom96: Also, I do share the "fear" around Nim dropping the GC. |
22:21:55 | Yardanico | watzon, what object? |
22:22:13 | dom96 | gokr: good, don't worry I'll keep fighting for it :) |
22:22:55 | Yardanico | watzon, nim is not really dynamic, so you'll need to create a json like that |
22:23:01 | watzon | Yardanico: an `object of RootObj` object called `TelegramObject*` |
22:23:09 | Yardanico | watzon, well, you would need to do it manually |
22:23:15 | watzon | Damn |
22:23:16 | Yardanico | like |
22:23:20 | watzon | Ok haha |
22:23:35 | Yardanico | let mydata = %*{"field": 1, "data": [1, 2, 3, 4]} |
22:23:44 | Yardanico | %* is a macro from json.nim which lets you write your json like this |
22:23:57 | Yardanico | let mydata = %*{"field": obj.myfield, "data": obj.mydata} |
22:24:14 | watzon | Well that's cool |
22:24:39 | gokr | watzon: You also have module marshal with the $$ proc |
22:24:53 | Yardanico | well but marshal shouldn't be generally used for APIs |
22:25:04 | Yardanico | (here it's telegram api) |
22:25:07 | gokr | sure, agree |
22:25:12 | Yardanico | and I think marshal should finally change |
22:25:14 | watzon | So I'm guessing there's not a pretty_print method of some kind that would allow you to print an object to the console in a readable way? |
22:25:26 | Yardanico | watzon, hmm, no |
22:25:35 | Yardanico | but this would be not that hard to create :P |
22:25:44 | gokr | For just dumping to console - why not $$ ? |
22:25:45 | Yardanico | well it would be quite hard |
22:25:47 | watzon | Oh well. That would be kinda nice to have built in though |
22:25:54 | Yardanico | watzon, well, yeah, as gokr said |
22:25:55 | watzon | I use it extensively in ruby and crystal |
22:25:59 | Yardanico | you can just |
22:26:06 | Yardanico | echo ($$myobj).pretty |
22:26:10 | Yardanico | $$ is from marshal module |
22:26:14 | Yardanico | ah wait |
22:26:15 | Yardanico | wrong |
22:26:15 | watzon | Would that work? |
22:26:20 | watzon | I'll try that |
22:26:41 | Yardanico | watzon, parseJson($$myobj).pretty |
22:26:54 | Yardanico | parseJson and pretty are from json |
22:26:56 | Yardanico | $$ is from marshal |
22:28:35 | watzon | Well it worked lol |
22:28:43 | watzon | I had to do this `echo(pretty(parseJson($$(update))))` |
22:28:49 | Yardanico | why? |
22:28:54 | Yardanico | you don't need to do that |
22:29:11 | Yardanico | echo parseJson($$myobj).pretty() |
22:29:13 | Yardanico | should work |
22:29:51 | watzon | You're right |
22:29:51 | Yardanico | yeah it does work |
22:29:53 | watzon | That worked |
22:29:59 | Yardanico | UFCS :P |
22:30:11 | watzon | Now I just need to write it to a file instead of using echo. That object is huge |
22:30:32 | Yardanico | writeFile("myfile", parseJson($$myobj).pretty()) |
22:31:01 | watzon | Yardanico: well aren't you on fire today |
22:31:08 | watzon | Saved me having to look it up in the api |
22:31:10 | watzon | Lol |
22:31:30 | Yardanico | well you still can open a file, write to it, close it |
22:31:35 | Yardanico | but it's 3 lines! :P |
22:31:50 | Yardanico | writeFile basically does the same |
22:32:04 | watzon | Yeah I'm all about less lines |
22:32:39 | gokr | echo pretty(%*myobj) |
22:32:47 | gokr | May also work, worked for an object for me. |
22:33:10 | Yardanico | lol it works |
22:33:11 | Yardanico | how?) |
22:33:25 | Yardanico | I didn't knew that it also works |
22:33:32 | Yardanico | Convert an expression to a JsonNode directly, without having to specify |
22:33:38 | Yardanico | watzon, so you don't need marshal |
22:33:43 | gokr | right |
22:33:49 | Yardanico | writeFile("myfile", pretty(%*myobj)) |
22:35:18 | watzon | Hmm not working for mine |
22:35:19 | gokr | That's one of those things I like in Nim stdlib. Reading or writing a file - single call. Simple. Filenames and paths are strings. Simple. |
22:35:22 | * | ipjk joined #nim |
22:35:26 | watzon | I'm getting `undeclared field` |
22:35:46 | watzon | But that is really nice |
22:35:52 | Yardanico | watzon, well it probably wouldn't work for all possible objects |
22:36:02 | Yardanico | gokr, also don't forget "my" / "file" / "path" :) |
22:36:21 | * | couven92 quit (Quit: Client Disconnecting) |
22:39:02 | gokr | Who made th play.nim-lang.org btw? |
22:39:09 | dom96 | zacharycarter |
22:39:10 | Yardanico | gokr, zacharycarter |
22:39:17 | Yardanico | dom96, ah, you're faster to type :P |
22:39:36 | Yardanico | gokr, https://github.com/zacharycarter/nim-playground |
22:39:40 | Yardanico | it's not that much lines |
22:39:44 | gokr | One neat thing would be to put the src as a base64 url param, that way one could share a code snippet. |
22:39:50 | Yardanico | gokr, you can share it |
22:39:51 | Yardanico | via gist |
22:40:00 | Yardanico | there's "create gist" button |
22:40:01 | gokr | Oh, well, but... then you can't run it anymore. |
22:40:08 | Yardanico | what do you mean? |
22:40:22 | Yardanico | gokr, https://play.nim-lang.org/?gist=cb47b9af98aa2382483bb1532e136d78 |
22:40:24 | gokr | Well, perhaps I misunderstood |
22:40:28 | gokr | ah, ok |
22:40:46 | Yardanico | you just press "create gist" after you've written some code |
22:40:51 | Yardanico | and it will create an anonymous gist |
22:40:59 | Yardanico | and give you gist/playground links |
22:41:03 | gokr | neat, ok, forget what I said then :) |
22:45:28 | Yardanico | nim: you have many ways to do one thing, but only one of them is idiomatic, and others are for fp/python/c programmers :P |
22:46:59 | Yardanico | but sometimes idiomatic way = python's way |
22:47:07 | Yardanico | or c way |
22:47:21 | Yardanico | nim allows much more freedom than other languages |
22:49:25 | Yardanico | syntax skins (I know that's probably gonna be removed, but who knows), identifier equality, UFCS, different backends, different GCs |
22:49:56 | darkn0de | is there like a dir() command as from python |
22:49:59 | * | zolk3ri quit (Quit: Lost terminal) |
22:50:02 | Yardanico | darkn0de, yep! |
22:50:09 | Yardanico | ah |
22:50:11 | Yardanico | sorry |
22:50:26 | Yardanico | there's no :P but it can be done with a macro, I'll probably try to do it today or tomorrow |
22:50:39 | Yardanico | darkn0de, why do you need dir anyway? |
22:50:42 | darkn0de | AWESOME :) is there an easy way to just find out the keys of an object |
22:50:45 | Yardanico | all fields are known at compile-time |
22:50:47 | darkn0de | trying to inspect things like response |
22:50:56 | darkn0de | just to avoid looking at docs ;) |
22:51:01 | Yardanico | well use "go to definition" |
22:51:03 | Yardanico | what's your editor? |
22:51:06 | darkn0de | vim |
22:51:09 | Yardanico | ah |
22:51:20 | Yardanico | vscode just has vscode-nim extension, and it supports nimsuggest |
22:51:27 | darkn0de | ah neat :) |
22:51:41 | Yardanico | so you just ctrl+click and you can see the source file with that type/variable/something else |
22:51:54 | Yardanico | darkn0de, https://nim-lang.org/docs/asynchttpserver.html#Request |
22:51:55 | darkn0de | that's cool. |
22:52:25 | darkn0de | yeah I was going to look :) just something I miss (like an interpreter) |
22:52:26 | watzon | +1 for the vscode-nim extension |
22:52:30 | Yardanico | darkn0de, nim secret |
22:52:37 | Yardanico | it's a command |
22:52:39 | darkn0de | can't import stuff though right? |
22:52:42 | Yardanico | you can |
22:52:46 | darkn0de | oh! |
22:52:48 | Yardanico | but only stuff that doesn't use C libraries |
22:52:53 | Yardanico | e.g. times module wouldn't work |
22:52:53 | darkn0de | oh ok |
22:52:59 | darkn0de | or net + openssl? |
22:53:05 | Yardanico | yeah that wouldn't work too |
22:53:13 | darkn0de | still cool though. |
22:53:26 | Yardanico | so it's called secret so people don't complain about it :P |
22:53:31 | darkn0de | and actually i was trying to play with times in it , so you're right |
22:53:37 | darkn0de | i guessed that part ;) |
22:53:40 | Yardanico | it uses tiny C compiler |
22:53:47 | darkn0de | cool |
22:53:48 | Yardanico | it's located directly in the Nim repo |
22:53:52 | Yardanico | (tinyc directory) |
22:53:56 | darkn0de | nice!! |
22:54:39 | darkn0de | like I'm getting 'undeclared field: body' on a response object that was just workign fine with it |
22:54:49 | darkn0de | dir(response) would be perfect ;) |
22:55:01 | FromGitter | <stisa> Yardanico are you sure about tinyc? I thought `secret` used the vm |
22:55:06 | Yardanico | stisa: oh |
22:55:10 | Yardanico | I may be wrong, yeah |
22:55:12 | Yardanico | it probably uses VM |
22:55:29 | Yardanico | darkn0de, nim has a virtual machine for running compile-time Nim code/macros/templates |
22:55:52 | Araq | dir(response) is actually a pretty weird solution |
22:55:56 | darkn0de | very cool. |
22:56:18 | darkn0de | Araq, how so? I just want it for debugging |
22:56:18 | darkn0de | to see what's in response |
22:56:39 | darkn0de | just not a while lot of data on why response is there (http response object) and not otherwise |
22:57:25 | darkn0de | as it turns out it was either i needed import tables |
22:57:28 | Araq | could use 'repr' instead |
22:57:37 | darkn0de | great point! |
22:57:58 | Araq | well firstly, 'dir' is an obscure name for this feature |
22:58:03 | Yardanico | Araq, fields ? |
22:58:15 | Araq | secondly, it's conflating runtime and compiletime aspects |
22:58:17 | darkn0de | fields is kind of like .items() in python yes? |
22:58:23 | darkn0de | Araq, very true. |
22:58:24 | Yardanico | darkn0de, I'm about name :) |
22:58:37 | darkn0de | :) |
22:59:07 | darkn0de | Araq, well, in Python it makes sense, because runtime is more or less compiletime |
22:59:31 | Yardanico | darkn0de, items() is actually a kinda-neccessary name in nim: if you name your iterator (for your object) "items()", it will for with for loop like that: "for item in myobj" |
22:59:37 | darkn0de | but here, I agree, but why not just show what attrs are in an object at compiletime |
22:59:48 | darkn0de | interesting |
23:01:58 | Yardanico | darkn0de, it's easy to get type definition of a type at compile-time |
23:05:11 | Yardanico | darkn0de, import macros |
23:05:12 | Yardanico | macro echoType(x: typed): untyped = echo toStrLit(x.symbol.getImpl()) |
23:05:22 | Yardanico | and then you can use it like echoType(MyObjectType) |
23:05:47 | Yardanico | well you can use it on stdlib types as well |
23:07:59 | * | nsf quit (Quit: WeeChat 1.9) |
23:15:06 | darkn0de | Yardanico, very awesome |
23:15:11 | darkn0de | I will try that thank you! |
23:16:01 | Yardanico | darkn0de, but don't forget that it would be printed at compile time |
23:16:17 | Yardanico | so after between "processing" stuff |
23:16:55 | darkn0de | Yardanico, I see that :) echoType(response) prints request(client, url, post_body, nil) ;) |
23:17:02 | Yardanico | well it's a variable |
23:17:09 | darkn0de | not exactly what the runtime result of response.body is |
23:17:10 | darkn0de | right |
23:17:11 | Yardanico | you should run it at Request |
23:17:18 | Yardanico | sorry |
23:17:19 | Yardanico | at Response |
23:17:33 | darkn0de | I did.. |
23:18:00 | darkn0de | i printed after doing the request. |
23:18:03 | Yardanico | darkn0de, are you sure? |
23:18:04 | Yardanico | hmm |
23:18:12 | Yardanico | echoType(Response) works if I import httpclient |
23:18:13 | darkn0de | but since it's run as a compiler macro, it ran before CC: ... lines |
23:18:33 | darkn0de | positive |
23:18:41 | Yardanico | darkn0de, are you using jester? |
23:19:02 | darkn0de | since i don't know what jester is, doubtful :) |
23:19:55 | darkn0de | here's what I see: Hint: ... (lots), request(...), Hint: [Link], operation successful [SuccessX], then output |
23:20:07 | darkn0de | in other words, it's actually before some compiling and linking. |
23:20:11 | Yardanico | darkn0de, yeah it's fine |
23:20:12 | Yardanico | darkn0de, I mean |
23:20:13 | darkn0de | pretty cool anyway. |
23:20:18 | Yardanico | what module you're using? |
23:20:22 | darkn0de | httpclient |
23:20:35 | Yardanico | well echoType(Response) would actually print a type definition |
23:20:51 | Yardanico | you should call this echoType on a type |
23:20:57 | Yardanico | yeah, I can add so you can call it at variables |
23:21:01 | Yardanico | but it's not one line anymore |
23:21:02 | Yardanico | or wait |
23:21:26 | darkn0de | https://pastebin.com/2VuD6FfS |
23:21:51 | Yardanico | darkn0de, this macro is meant to echo fields of a type, not fields of a variable :) |
23:22:01 | Yardanico | like "body: string" |
23:22:06 | Yardanico | "statusCode: int" |
23:22:29 | darkn0de | Yardanico, right :) https://pastebin.com/q5rdW2rv |
23:22:51 | Yardanico | darkn0de, sooo, you shouldn't call it on "response" |
23:22:55 | darkn0de | exactly.. but the Response object fields should be already known to the compiler at compile time, right? |
23:23:08 | Yardanico | yes, but there's no macro like that in stdlib |
23:23:12 | Yardanico | it can be done though |
23:23:13 | darkn0de | so in other words, I'm just looking to know what fields are in that object. (i.e., status, body, etc) |
23:23:23 | darkn0de | ah no worries :) |
23:23:24 | Yardanico | darkn0de, you need values or types? |
23:23:37 | darkn0de | types. well, attribute names :) |
23:23:43 | Yardanico | my macro does that |
23:23:45 | Yardanico | as I said |
23:23:51 | darkn0de | the echoType one? |
23:23:55 | Yardanico | you DON'T need to call it on a variable, yes! |
23:23:58 | darkn0de | ah :) |
23:24:05 | Yardanico | you should call it on a type |
23:24:16 | Yardanico | I'll make it work for variables now |
23:24:16 | darkn0de | ok! :) |
23:24:20 | darkn0de | awesome!! |
23:24:30 | darkn0de | gotta run to dinner but brilliant macro |
23:24:34 | darkn0de | ok cya |
23:31:43 | * | Kingsquee joined #nim |
23:33:17 | Yardanico | darkn0de, didn't test it extensively, but still: https://gist.github.com/Yardanico/7b961cbeb5c8d797e5f4ecf80ff639b0 |