00:30:02 | * | jinshil quit (Quit: Good-bye!) |
00:56:45 | * | ludocode quit (Ping timeout: 240 seconds) |
00:56:54 | watzon | I can't remember how to get the size of a openArray |
00:57:16 | watzon | Is it just `size(array)`? |
01:08:50 | * | mahmudov joined #nim |
01:15:24 | watzon | Nvm, I found it |
02:14:59 | * | Ven`` joined #nim |
02:18:54 | * | endragor joined #nim |
02:30:01 | * | ludocode joined #nim |
02:31:43 | * | gangstacat quit (Quit: Leaving) |
02:37:00 | * | relax joined #nim |
02:38:13 | * | Ven`` quit (Ping timeout: 246 seconds) |
02:46:45 | * | Tanger joined #nim |
02:50:37 | * | endragor quit (Remote host closed the connection) |
02:59:06 | * | couven92 quit (Read error: Connection reset by peer) |
03:21:03 | * | BitPuffin|osx quit (Ping timeout: 248 seconds) |
03:26:03 | * | endragor joined #nim |
03:29:15 | * | relax quit (Ping timeout: 240 seconds) |
03:30:39 | * | endragor quit (Ping timeout: 248 seconds) |
03:40:06 | * | vivus quit (Quit: Leaving) |
03:48:05 | * | mahmudov quit (Remote host closed the connection) |
04:00:47 | * | mahmudov joined #nim |
04:02:56 | * | endragor joined #nim |
04:07:27 | * | endragor quit (Ping timeout: 252 seconds) |
04:21:57 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
04:30:10 | * | mahmudov quit (Remote host closed the connection) |
04:31:21 | * | mahmudov joined #nim |
04:34:50 | * | francisl joined #nim |
04:39:06 | * | endragor joined #nim |
04:43:07 | * | dddddd quit (Remote host closed the connection) |
04:43:45 | * | endragor quit (Ping timeout: 248 seconds) |
05:21:22 | * | miran joined #nim |
05:26:01 | * | miran quit (Ping timeout: 255 seconds) |
05:38:24 | * | mahmudov quit (Remote host closed the connection) |
05:38:52 | * | miran joined #nim |
05:39:35 | * | mahmudov joined #nim |
05:51:27 | * | endragor joined #nim |
05:52:19 | * | Vladar joined #nim |
05:55:45 | * | endragor quit (Ping timeout: 240 seconds) |
06:08:03 | * | francisl quit (Quit: francisl) |
06:09:26 | * | fridgeseal joined #nim |
06:12:47 | * | ludocode quit (Ping timeout: 260 seconds) |
06:27:30 | * | endragor joined #nim |
06:32:10 | * | endragor quit (Ping timeout: 255 seconds) |
06:32:21 | * | miran quit (Ping timeout: 240 seconds) |
06:36:09 | * | nsf joined #nim |
06:41:38 | * | Vi- joined #nim |
06:44:19 | * | ludocode joined #nim |
06:49:47 | * | gangstacat joined #nim |
06:52:22 | FromGitter | <Varriount> dom96: There are some posts on the forum that need to be approved |
06:55:23 | * | rauss quit (Quit: WeeChat 1.9) |
06:55:35 | * | ludocode quit (Ping timeout: 240 seconds) |
06:58:50 | * | ludocode joined #nim |
07:03:25 | * | Vi- quit (Quit: Leaving) |
07:20:38 | * | PMunch joined #nim |
07:23:44 | * | fridgeseal quit (Ping timeout: 260 seconds) |
07:31:39 | * | yglukhov joined #nim |
07:32:30 | * | yglukhov quit (Read error: Connection reset by peer) |
07:32:40 | * | yglukhov joined #nim |
07:34:01 | * | yglukhov quit (Remote host closed the connection) |
07:34:14 | * | yglukhov joined #nim |
07:39:10 | * | BitPuffin|osx joined #nim |
07:39:59 | * | endragor joined #nim |
07:44:26 | * | endragor quit (Ping timeout: 246 seconds) |
07:57:24 | * | mahmudov quit (Remote host closed the connection) |
07:59:40 | * | Yardanico joined #nim |
08:16:15 | * | endragor joined #nim |
08:21:00 | * | endragor quit (Ping timeout: 252 seconds) |
08:27:51 | * | nattefrost joined #nim |
08:36:17 | * | nattefrost quit (Ping timeout: 260 seconds) |
08:36:32 | * | nattefrost joined #nim |
08:44:59 | * | Arrrr joined #nim |
08:48:04 | Yardanico | Araq, is there a limitation for naming procedures? E.g. I have a proc "range", and if I import it from another module - Nim tries to use range from system.nim, not from my module https://gist.github.com/Yardanico/a16f6e93b300edb34d474104fe6d4618 |
08:48:14 | Yardanico | so I can only use "range" from another module using include |
08:53:13 | Yardanico | hmm, maybe I can solve this by creating small file which would import my other module and create templates to change names |
09:03:30 | Araq | types and procs cannot be overloaded |
09:03:49 | Araq | and actually the compiler should error with a "requires disambiguation" message |
09:04:04 | Araq | you can always use mymodule.range |
09:05:55 | * | dom96|w joined #nim |
09:29:16 | * | endragor joined #nim |
09:33:21 | * | endragor quit (Ping timeout: 240 seconds) |
09:37:22 | Yardanico | Can I use string in nim for the same purpose as "bytearray" in Python? |
09:37:37 | Yardanico | or it's better to use a sequence? |
09:39:52 | * | couven92 joined #nim |
09:46:54 | PMunch | Yardanico, probably a seq[uint8] would be best |
09:47:10 | PMunch | After all that is what a bytearray is |
09:47:42 | Yardanico | PMunch, well I want to port a python package for querying minecraft server, and I'm firstly porting this file: https://github.com/Dinnerbone/mcstatus/blob/master/mcstatus/protocol/connection.py |
09:47:56 | Yardanico | maybe I should use "streams" here |
09:48:16 | Yardanico | implement my own SocketStream (because I'll need to unpack stuff) |
09:48:27 | Yardanico | well I can just use struct.nim |
09:49:11 | PMunch | Ah, so he uses a bytearray to hold either a string, or something from a Connection |
09:49:35 | PMunch | Isn't that also a string though, or does Minecraft use a binary format over their sockets? |
09:49:47 | PMunch | brb, lunch |
09:52:59 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
09:54:35 | * | dom96|w joined #nim |
10:04:24 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
10:05:41 | * | endragor joined #nim |
10:10:07 | * | endragor quit (Ping timeout: 248 seconds) |
10:14:54 | Arrrr | string is used a lot in nim as a bytearray |
10:22:24 | * | Xe quit (Ping timeout: 248 seconds) |
10:27:30 | * | Xe joined #nim |
10:31:55 | PMunch | back now |
10:32:26 | PMunch | Yardanico, did you figure out a way to port it? |
10:39:49 | * | endragor joined #nim |
10:44:30 | FromGitter | <AjBreidenbach> Is it ever useful to create a ref/obj pair when a type is only ever passed by value? I don't really understand the documentation. |
10:48:04 | * | nattefrost quit (Remote host closed the connection) |
10:55:03 | FromGitter | <krux02> @AjBreidenbach what do you mean with ref/obj pair? |
10:55:55 | FromGitter | <krux02> I personally don't use ref types at all, because objects are already passed by reference |
10:55:59 | FromGitter | <AjBreidenbach> For example in the dom module ⏎ ⏎ ``` Node* = ref NodeObj ⏎ NodeObj {.importc.} = object of EventTargetObj``` [https://gitter.im/nim-lang/Nim?at=59a3f6bfc101bc4e3a647a28] |
10:56:30 | Yardanico | dom96, lol https://twitter.com/NateTheFinch/status/899730215957561344 |
10:56:38 | Yardanico | this is the reason why I don't like go |
10:56:43 | Yardanico | (error handling) |
10:56:45 | FromGitter | <krux02> well that is just style and I don't like that style |
10:58:13 | FromGitter | <krux02> I prefer to not declare a type with the Obj postfix. |
10:58:55 | FromGitter | <AjBreidenbach> so, it's not functional? |
10:59:13 | FromGitter | <krux02> I just declare the object type without the postfix, and if I would use the ref type, I would use it litterally |
10:59:14 | FromGitter | <AjBreidenbach> it would just be if you want to pass a value, right? |
10:59:18 | FromGitter | <krux02> type MyType = object |
10:59:25 | FromGitter | <krux02> proc foo(arg: MyType) |
10:59:30 | FromGitter | <krux02> proc bar(arg: ref MyType) |
10:59:51 | FromGitter | <krux02> But as I said I figuerd out that I don't need "ref" at all |
11:00:00 | * | dom96|w joined #nim |
11:00:11 | * | arnetheduck joined #nim |
11:00:31 | FromGitter | <AjBreidenbach> ok, I understood. it's only relevant for how the object is passed, thought, right? |
11:00:42 | FromGitter | <krux02> well wen you pass an object in Nim, the argument is probably pass by const reference |
11:00:56 | FromGitter | <krux02> not rally |
11:01:02 | Araq | ref MyType and MyType are completely differetn things |
11:01:09 | Araq | fyi: https://blog.regehr.org/archives/1307 |
11:01:45 | FromGitter | <krux02> what you mean is probably proc baz(arg: var MyType) |
11:01:57 | FromGitter | <krux02> bas passes the argument by mutable reference |
11:02:20 | FromGitter | <krux02> the "var" parameter is what you might know from c++ as the "reference" |
11:02:34 | FromGitter | <krux02> the "ref" is more like the "std::shared_ptr" |
11:03:20 | FromGitter | <krux02> and foo is in c++ terms `void foo(const MyType& arg)` |
11:03:52 | FromGitter | <krux02> probably, because the compiler could also decide to copy the arg for ``foo`` |
11:04:12 | arnetheduck | Araq, https://github.com/nim-lang/Nim/pull/5818 should be good to go - fails windows tests because of test suite being too slow it seems |
11:05:17 | Araq | well it used to be "not too slow" |
11:05:31 | Araq | if your PR makes it too slow, guess what, it indicates a problem |
11:06:07 | Yardanico | hmm, I looked at generated C source and it seems there's no difference between "let" and "var" if object is not changed. is that true? |
11:06:35 | Yardanico | I thought "let" makes some optimisations too |
11:07:10 | arnetheduck | or it just randomly got assigned a slower appveyor host |
11:07:47 | Yardanico | well, https://github.com/nim-lang/Nim/pull/6190 would speed it up a bit |
11:07:55 | Yardanico | ~1.3-1.7 on 2 core I think |
11:08:14 | Yardanico | both travis and appveyor have 2 cores |
11:08:50 | arnetheduck | a successful test takes 57mins for a random succeeding branch, and the cutoff is at 60 mins.. that's 3mins of grace t ime |
11:08:57 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
11:09:19 | arnetheduck | 57:42 mins, so 2:something mins |
11:09:31 | Araq | appveyor said they changed the timeouts to 1 hour and 30 mins |
11:09:52 | FromGitter | <krux02> Yardanico, well in the backend let and var is the same afaik |
11:09:53 | arnetheduck | not when the test for that branch ran |
11:10:14 | Yardanico | krux02: ok, so "let" is only useful for not making mistakes? |
11:10:15 | FromGitter | <krux02> it is just to ensure that a value doesn't change anymore |
11:10:20 | Yardanico | ok |
11:10:24 | FromGitter | <krux02> I would assume so |
11:10:48 | arnetheduck | any easy way to rerun the test? |
11:11:06 | FromGitter | <krux02> I like to use as few var states as possible, because managing state is kind of hard |
11:11:14 | * | endragor quit (Remote host closed the connection) |
11:11:34 | arnetheduck | " Failed 10 days ago in 1 hr " |
11:11:44 | FromGitter | <krux02> and when you see a let you can safely assume nobody changes that value |
11:12:22 | FromGitter | <krux02> local state is ok though, like mutating the result |
11:15:37 | Araq | let IS used for optimization purposes already |
11:16:01 | Araq | but not in all cases |
11:17:34 | FromGitter | <krux02> but is it used for a lot of optimizations, so that using a lot of let can significantly improve performance? |
11:18:30 | FromGitter | <krux02> but yes let should be used for performance optimization, but I still think the most important thing about ``let`` is to aid the programmer. Ant least right now. |
11:19:01 | Araq | actually it is wrongly used for optimization :-) |
11:19:32 | Araq | and should be replaced by a better optimizer, you're right that 'let' is about the programmer's intend |
11:24:09 | * | dddddd joined #nim |
11:33:49 | PMunch | It's good practice though to mark things you don't plan on changing with let. That way future optimizations in the compiler will actually benefit your code :) |
11:34:08 | PMunch | Plus of course you show your intent with the variable which is always nice. |
11:36:52 | * | dom96|w joined #nim |
11:37:03 | Araq | well yes but my point is that "future optimizations in the compiler" won't rely on var vs. let, it can compute that the 'var' is in fact a 'let' |
11:37:27 | PMunch | Ah, that's a fair point |
11:42:14 | * | Snircle joined #nim |
11:44:20 | * | endragor joined #nim |
11:53:04 | FromGitter | <krux02> @Araq: seems like you could produce a "hint" in the compiler that says "this var could be a let" :P |
11:55:15 | Yardanico | well why not? there's a warning "Warning: 'l' should not be used as an identifier; may look like '1' (one)" |
11:55:21 | FromGitter | <andreaferretti> +1 |
12:00:07 | * | haha_ joined #nim |
12:00:33 | Yardanico | hmm, https://design.perl6.org/S15.html#Numbers |
12:00:43 | Yardanico | say 42 + ٤٢; # ascii digits + arabic indic |
12:01:55 | def- | @krux02 that can be annoying when it's just temporarily used as immutable, for example because you just started the implementation, commented out some code, or potentially something hidden under a when. At least these kinds of warnings sometimes annoy me because of that, especially if they're enforced as errors |
12:02:41 | * | tdc joined #nim |
12:03:19 | Yardanico | well if this will be added, it should be a "hint", not a warning |
12:08:05 | FromGitter | <krux02> First of all, it's like unused variable. When you just declared a variable of course it is usused |
12:08:21 | FromGitter | <krux02> but I don't think it's important right now |
12:09:59 | FromGitter | <andreaferretti> Still, it could be used to let newbies learn about var vs let |
12:10:09 | FromGitter | <andreaferretti> which is a topic which comes about extremely often |
12:10:24 | FromGitter | <andreaferretti> A hint is rather unobstrusive |
12:11:13 | FromGitter | <krux02> I am not saying it shouldn't be done nor it is not useful, because it is. All I say is, it is not important right now. |
12:11:51 | FromGitter | <krux02> I think Nim still has a few ugly things under the hood that need to go away and would introduce breaking changes |
12:12:32 | FromGitter | <krux02> like the removal of the distinct nil value for seq and string |
12:12:55 | FromGitter | <krux02> anything that breaks backwardscompatibility should get out of the door as fast as possible |
12:13:15 | FromGitter | <krux02> before too much code relies on it |
12:15:27 | * | haha_ quit (Quit: haha_) |
12:16:01 | FromGitter | <andreaferretti> agreed |
12:17:05 | * | gangstacat quit (Quit: Leaving) |
12:23:45 | * | haha_ joined #nim |
12:34:34 | dom96|w | yep, we need to focus on backwards compatibility breaking changes for now |
12:34:46 | dom96|w | agree as well |
12:38:19 | Yardanico | yeah |
12:38:40 | Yardanico | after 1.0 we can't just do stuff like changing behaviour of "quote do" |
12:39:04 | Yardanico | like all compatibility stuff |
12:42:28 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
12:45:27 | * | dom96|w joined #nim |
13:02:50 | * | rauss joined #nim |
13:04:22 | demi- | hmm; is there any way I could get an AsyncFile handle of `stdout`? |
13:12:26 | * | dddddd quit (Quit: Hasta otra..) |
13:12:45 | * | dddddd joined #nim |
13:13:55 | arnetheduck | Araq, lo and behold, the same code for https://github.com/nim-lang/Nim/pull/5818 now passes in 56 minutes |
13:23:54 | * | endragor quit (Remote host closed the connection) |
13:28:38 | * | BitPuffin|osx quit (Read error: Connection reset by peer) |
13:33:36 | * | BitPuffin|osx joined #nim |
13:36:31 | dom96|w | demi-: yes, but it won't work on Windows. |
13:38:50 | Araq | arnetheduck: nice :-) |
13:39:26 | * | couven92 quit (Read error: Connection reset by peer) |
13:39:36 | * | endragor joined #nim |
13:43:45 | * | endragor quit (Ping timeout: 240 seconds) |
13:47:52 | Yardanico | arnetheduck, a typo: in lib/system.nim at 272 - boudns |
13:47:58 | Yardanico | should I make a mini-PR? |
13:48:12 | * | haha_ quit (Quit: haha_) |
13:49:01 | arnetheduck | Yardanico, pls yes, if you can |
13:49:26 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
13:49:33 | Yardanico | arnetheduck, well I always can :) |
13:49:35 | Yardanico | https://github.com/nim-lang/Nim/pull/6285 |
13:49:47 | * | haha_ joined #nim |
13:51:44 | FromGitter | <dandevelop> Do you use a debugger to debug your nim code? |
13:52:57 | Yardanico | I don't, there was no need to use it (at least for me) |
13:57:11 | * | relax joined #nim |
14:17:14 | * | william1 joined #nim |
14:17:25 | * | william1 left #nim (#nim) |
14:18:42 | demi- | dom96: that is fine; i don't care about windows |
14:19:16 | * | loc8 joined #nim |
14:27:31 | * | PMunch quit (Quit: Leaving) |
14:36:30 | * | haha_ quit (Quit: haha_) |
14:40:10 | * | haha_ joined #nim |
14:40:28 | Gertm | When using the parsecfg module, how can I make sure the strings I write to the config are quoted in the config? |
14:41:55 | Gertm | Does it figure out itself? |
14:43:43 | Gertm | figure it* out itself? |
14:43:53 | Gertm | My tests do indicate that it figures it out itself. |
14:45:50 | * | arnetheduck quit (Ping timeout: 246 seconds) |
14:51:34 | Araq | yeah I don't think you can influence this |
14:51:46 | Araq | it "simply works (tm)" (unless it doesn't) |
15:00:19 | loc8 | Does Nim have a format for build scripts? Like Makefiles, for example. |
15:01:09 | * | kier quit (Quit: No Ping reply in 180 seconds.) |
15:01:34 | Yardanico | loc8, create .nims file? |
15:02:04 | * | dom96|w joined #nim |
15:02:07 | Yardanico | loc8, https://github.com/nim-lang/nimble#creating-packages |
15:02:13 | Yardanico | You can place any Nim code inside these tasks. As long as that code does not access the FFI. The nimscript module in Nim's standard library defines additional functionality such as the ability to execute external processes which makes this feature very powerful. |
15:02:29 | loc8 | Thank you! |
15:06:33 | * | kier joined #nim |
15:11:23 | * | oaao quit (Read error: Connection reset by peer) |
15:13:54 | Demos[m] | One of the things I love about nim. You just write build scripts in nim! |
15:14:07 | * | Trustable joined #nim |
15:25:42 | dom96|w | yay, that talk went well :) |
15:26:16 | Araq | dom96|w: tell me! :D |
15:27:01 | dom96|w | Some concerns about having to handle the AST directly |
15:27:32 | dom96|w | And also one person mentioned that they checked Nim out a long time ago and found the style insensitivity odd. |
15:28:42 | Araq | aha |
15:29:12 | Araq | well I just fixed yet another critical codegen bug, #6279 |
15:30:28 | FromGitter | <ephja> there are still bugs? :p |
15:30:55 | FromGitter | <dandevelop> @Araq do you use any debuggers to debug Nim? |
15:31:50 | Araq | no. |
15:33:06 | Araq | and I haven't used C#'s debugger much either back then when I used C# extensively |
15:33:08 | Zevv | I bet you're single stepping your way through your code all day :) |
15:33:40 | * | haha_ quit (Quit: haha_) |
15:33:46 | dom96|w | Some also asked about the readability of the generated C code |
15:33:55 | Yardanico | well ask them for readability of LLVM :D |
15:34:13 | Yardanico | also PyPy uses C as backend |
15:34:16 | dom96|w | Althouh there was some love for compiling to C actually :) |
15:34:22 | dom96|w | *although |
15:34:34 | Yardanico | but PyPy C code is a lot more obfuscated |
15:35:09 | Yardanico | and compiling is a lot slower (because their compiler is written in python) |
15:35:25 | Yardanico | PyPy can take 30-90 minutes to compile |
15:35:33 | dom96|w | :o |
15:36:22 | Yardanico | so I actually like nim compilation times |
15:36:46 | dom96|w | I think it would be a good idea to investigate how long compilers take to compile |
15:36:49 | dom96|w | and create a little chart |
15:37:05 | dom96|w | because I thought 6 seconds is long (that's how long Nim takes) |
15:37:06 | dom96|w | But I guess it really isn't |
15:37:29 | Yardanico | dom96|w, it's very fast actually |
15:37:54 | FromGitter | <ephja> roughly how much faster can the compilation of nim code get? |
15:38:08 | FromGitter | <ephja> can the processing of unchanged modules be sped up? |
15:38:22 | Yardanico | well nim processes them very fast actually |
15:38:28 | Araq | it was, that feature is called --symbolFiles |
15:38:48 | Araq | got bootstrapping times of 0.1s on what's now old hardware |
15:39:25 | FromGitter | <ephja> yeah that's pretty good |
15:39:34 | dom96|w | yeah, I'm sure there is plenty of optimisations that could be done |
15:39:40 | FromGitter | <ephja> it doesn't take long by all means, but it's noticeable when you have lots of modules |
15:40:35 | Yardanico | Araq, does it work now? |
15:40:44 | FromGitter | <ephja> I'm looking at you, nimx :D |
15:41:15 | Araq | I doubt it, recently made some old tests work again |
15:41:53 | Yardanico | Araq, well yeah it's giving me some internal compiler error |
15:41:59 | Yardanico | Error: internal error: (filename: evaltempl.nim, line: 45) |
15:42:08 | Yardanico | while processing parseutils |
15:42:46 | FromGitter | <ephja> I'll compare compiling nimx code with and without symbol files |
15:43:31 | Yardanico | well it seems to fail for me |
15:44:09 | Yardanico | Error: internal error: could not serialize some forwarded symbols/types |
15:44:31 | Araq | fix it :P |
15:45:41 | Yardanico | well I don't really need faster compilation times :) |
15:47:53 | Yardanico | ah, it's already on github issues |
15:47:59 | Yardanico | https://github.com/nim-lang/Nim/issues/1031 |
15:50:48 | Araq | yeah, I'd like to rewrite large parts of the compiler to use "pointer free" programming :P |
15:51:19 | Araq | pointers suck... |
15:54:56 | FromGitter | <ephja> replacing pointers with option types? |
15:58:24 | Araq | kind of and with IDs |
16:03:44 | * | Matthias247 joined #nim |
16:05:58 | Yardanico | well symbolFiles work for system.nim |
16:14:18 | Yardanico | isn't there a way to tell to compiler to "skip" failed generation of symbol files? |
16:14:21 | * | yglukhov quit (Remote host closed the connection) |
16:14:45 | * | Matthias247 quit (Read error: Connection reset by peer) |
16:15:04 | * | yglukhov joined #nim |
16:17:18 | FromGitter | <ephja> is it worth the effort compared to just fixing the bug in question? :p |
16:18:04 | * | yglukhov quit (Read error: Connection reset by peer) |
16:18:17 | * | yglukhov joined #nim |
16:18:31 | FromGitter | <ephja> to whoever implements the bug circumvention mechanism lol |
16:19:43 | Araq | it's not a single bug |
16:20:26 | Araq | many of the data structures and AST passes are not re-entrant in the sense that you can load partial results from disk |
16:23:10 | * | yglukhov quit (Ping timeout: 276 seconds) |
16:29:17 | * | haha_ joined #nim |
16:31:38 | FromGitter | <BigEpsilon> Hi Araq, just a little question: Are integer template parameter not supported in c2nim (just making sure because it seems so) ? is it because of an intrinsic difficulty or just that there was no need for it until now ? I'm trying to write a wrapper for opencv combining the python wrapper generator and c2nim |
16:36:38 | * | haha_ quit (Quit: haha_) |
16:40:36 | * | haha_ joined #nim |
16:50:58 | * | haha_ quit (Quit: haha_) |
16:51:15 | * | couven92 joined #nim |
16:51:19 | * | ipjk joined #nim |
16:53:23 | loc8 | What's the current state of coroutines in Nim? |
16:56:32 | * | vivus joined #nim |
16:58:04 | Yardanico | loc8, well there's async if you want it |
16:58:31 | Yardanico | also there are coroutines - https://nim-lang.org/docs/coro.html |
16:58:39 | Yardanico | but it's not very portable |
16:58:58 | loc8 | I was taking a look at that... |
16:59:28 | loc8 | I'm using Jester for a web server, and `runForever()` seems to block other code from running |
16:59:39 | loc8 | Does it support starting the server on a separate thread? |
17:01:25 | dom96|w | loc8: indeed, async await is single threaded |
17:01:38 | dom96|w | Might be able to advise if you tell me your use case |
17:03:44 | * | tdc_ joined #nim |
17:06:41 | * | tdc quit (Ping timeout: 248 seconds) |
17:06:53 | * | huonw quit (Ping timeout: 246 seconds) |
17:08:56 | * | huonw joined #nim |
17:09:37 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
17:10:39 | loc8 | Gotta start the Jester server, keep it running, and run other code after it has started |
17:12:48 | Yardanico | loc8, asyncCheck anotherAsyncProc() ? |
17:13:15 | Yardanico | (unless your other code is computationally intensive) |
17:14:18 | Yardanico | if it is, use threads :) |
17:18:38 | * | oaao joined #nim |
17:30:50 | dom96 | loc8: what does the other code do? |
17:32:31 | * | miran joined #nim |
17:42:52 | Yardanico | oh wait, symbolFiles actually worked for one of my small apps! |
17:43:10 | Yardanico | oh |
17:44:45 | Yardanico | well it generated symbol files successfully |
17:44:49 | Yardanico | but it can't read them :) |
17:45:25 | Yardanico | but honestly this is a very cool feature |
17:49:00 | * | vendethiel- joined #nim |
17:50:01 | Yardanico | if we make it work some time, it would be another cool feature :) |
17:54:06 | * | nsf quit (Quit: WeeChat 1.9) |
17:56:34 | Demos[m] | what's the procedure for renaming a package in nimble? |
17:57:42 | Yardanico | Demos[m], make a PR to nim-lang/packages :) |
17:57:46 | Yardanico | but firstly change your .nimble file |
17:59:08 | Demos[m] | yeah I'm gunna up the version and make some major changes :D |
18:00:20 | * | Yardanico quit (Remote host closed the connection) |
18:05:16 | * | enthus1ast__ joined #nim |
18:06:14 | dom96 | read the nim-lang/packages readme |
18:06:21 | dom96 | There is a bit more to it than that |
18:06:23 | enthus1ast__ | dom96, can i let the javascript backend generate the "await" keyword? |
18:06:36 | dom96 | elaborate |
18:06:55 | enthus1ast__ | should i play with emit? |
18:07:25 | Araq | enthus1ast__: yes |
18:07:27 | * | Ven joined #nim |
18:07:34 | enthus1ast__ | yes to emit? |
18:07:50 | * | Ven is now known as Guest73037 |
18:08:10 | FromGitter | <stisa> enthus1ast_ I'd use something like `{.importcpp: "await #".}` |
18:08:37 | enthus1ast__ | ahh |
18:08:45 | enthus1ast__ | ty ill try that |
18:10:45 | * | PMunch joined #nim |
18:15:50 | enthus1ast__ | 1. how can i export (global) variables in javascript? Withouth defineing a getter for each? |
18:15:55 | enthus1ast__ | 2. what is the prefered way to the converted jsffi JsObject to an json JsonNode? |
18:17:47 | Araq | var myglobal {.exportc.}: T |
18:19:59 | * | Arrrr1 joined #nim |
18:19:59 | * | Arrrr quit (Disconnected by services) |
18:20:03 | * | Arrrr1 quit (Client Quit) |
18:22:17 | enthus1ast__ | Aray, ty works! |
18:22:24 | enthus1ast__ | -.- |
18:22:27 | enthus1ast__ | Araq |
18:26:20 | * | yglukhov joined #nim |
18:30:49 | * | yglukhov quit (Ping timeout: 255 seconds) |
18:36:41 | * | haha_ joined #nim |
18:43:35 | * | enthus1ast__ quit (Ping timeout: 240 seconds) |
18:50:16 | loc8 | I'm having a bit of a problem using Jester together with nimongo |
18:50:57 | loc8 | Trying to call `db.find(...)` inside a route causes the code to stop compiling |
18:51:25 | loc8 | Thought it could be something with async and having to wait for the call, changed to the async version of nimongo |
18:51:36 | loc8 | Still gives me a compile error |
18:53:42 | FromGitter | <Yardanico> Well can you give source and full traceback? |
18:54:28 | loc8 | Sure |
18:57:35 | * | Vladar quit (Quit: Leaving) |
18:59:16 | loc8 | Yardanico, https://pastebin.com/Fa0t3pVP |
19:01:48 | * | Matthias247 joined #nim |
19:04:13 | * | Guest73037 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:05:37 | * | yglukhov joined #nim |
19:16:13 | * | BigEpsilon joined #nim |
19:17:05 | * | ipjk quit (Quit: Leaving) |
19:17:56 | BigEpsilon | Hi Araq, just a little question: Are integer template parameter not supported in c2nim (just making sure because it seems so) ? is it because of an intrinsic difficulty or just that there was no need for it until now ? I'm trying to write a wrapper for opencv combining the python wrapper generator and c2nim |
19:19:24 | FromGitter | <Varriount> BigEpsilon: What trouble are you running into? |
19:19:30 | Araq | what are integer template parameters? oh ... yeah, c2nim only supports type parameters |
19:20:22 | FromGitter | <Varriount> Araq, dom96: Might be worth looking at Python's unified TLS proposal for ideas on the Nim library: https://www.python.org/dev/peps/pep-0543/#interfaces |
19:20:53 | * | nsf joined #nim |
19:22:03 | Araq | varriount: thanks, but I cannot abstract over things I do not understand |
19:24:07 | Araq | in fact, I don't even understand sockets. open/read/write/close, what was wrong with that? ;-) |
19:29:25 | BigEpsilon | @Varriount: c2nim is unable to parse template that have integer parameter. Ex: template <int N> foo(...) |
19:29:33 | * | BigEpsilon left #nim ("Quit") |
19:29:46 | * | BigEpsilon joined #nim |
19:30:41 | FromGitter | <Varriount> BigEpsilon: Ah, gotcha. I was getting templates confused with C macros. |
19:32:11 | dom96 | loc8: You should be using 'await' instead of 'waitFor' |
19:32:20 | dom96 | But the error you're seeing is likely due to thread analysis |
19:32:34 | dom96 | Try compiling with --threadAnalysis:off and report this as a bug on Nim's repo |
19:32:51 | * | Trustable quit (Remote host closed the connection) |
19:34:25 | BigEpsilon | Araq, do you think it needs alot of work to add the support for integer type template arguments to c2nim |
19:34:27 | BigEpsilon | ? |
19:36:12 | BigEpsilon | Im considering doing that |
19:38:55 | loc8 | dom96: I've changed back to the synchronous nimongo and added the '--threadAnalysis:off' option and it does compile now |
19:39:25 | dom96 | why synchronous? |
19:39:31 | dom96 | use asynchronous nimongo if you can |
19:40:45 | loc8 | It tells me `await` doesn't exist. I have imported `asyncdispatch` |
19:43:48 | dom96 | You need to mark your proc with {.async.} |
19:44:39 | loc8 | Ah, forgot about that part. Thx |
19:47:30 | * | tdc_ quit (Ping timeout: 240 seconds) |
19:47:42 | * | dom96|w joined #nim |
19:52:51 | * | dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
20:16:05 | * | rosshadden joined #nim |
20:17:01 | * | rauss quit (Ping timeout: 240 seconds) |
20:18:07 | loc8 | Yardanico: It fails to compile with `--gc:boehm --threads:on` |
20:19:52 | Araq | BigEpsilon: give it a try please :-) |
20:20:28 | BigEpsilon | I will :) |
20:21:58 | FromGitter | <dandevelop> Taking a look at the generated C code I see something like: TM_xX9bjDcaROYxTwOBG6CT5Vw_0[19].kind = ⏎ TM_xX9bjDcaROYxTwOBG6CT5Vw_0[19].offset = ⏎ TM_xX9bjDcaROYxTwOBG6CT5Vw_0[19].typ = ⏎ TM_xX9bjDcaROYxTwOBG6CT5Vw_0[19].name = "functionName" [https://gitter.im/nim-lang/Nim?at=59a47b65c101bc4e3a671e3c] |
20:22:17 | Araq | so? |
20:22:22 | FromGitter | <dandevelop> Is there any option to not generate these? I am interested in the name part |
20:22:40 | FromGitter | <dandevelop> It gets written in the executable |
20:22:56 | FromGitter | <dandevelop> Is there any way for "functionName" not to be written in the executable? |
20:23:30 | FromGitter | <dandevelop> More specific, I am looking for a way not to include variables, fields and function names in the executable |
20:24:40 | Araq | function names are not part of the RTTI |
20:24:53 | Araq | neither are variable names |
20:25:12 | FromGitter | <dandevelop> So is there any way for them not to be written in the executable? |
20:25:15 | Araq | only enum and object fields are affected and I think we can do without object fields |
20:25:33 | Araq | currently, no, you need to patch compiler/ccgtypes.nim |
20:25:44 | FromGitter | <Varriount> @dandevelop Generally function names and variables names in the source code are erased once the C compiler translates them into object files. |
20:26:07 | FromGitter | <dandevelop> @Varriount that's what I would also expect but it looks like they are not |
20:26:16 | FromGitter | <dandevelop> @Varriount that is why I am asking |
20:26:31 | FromGitter | <Varriount> What tool are you using to examine the binaries? |
20:27:31 | FromGitter | <dandevelop> Any text editor can be used |
20:27:34 | FromGitter | <Varriount> And are you compiling in release mode, without stack trace information? |
20:28:09 | FromGitter | <dandevelop> @Varriount like this: -d:release --opt:speed -d:noAutoGLerrorCheck --stackTrace:off --lineTrace:off --lineDir:off |
20:28:18 | dom96 | loc8: Ahh yes, no wonder this happens, you've got a global variable. |
20:28:26 | dom96 | The error message could be better IMO |
20:28:43 | dom96 | In any case, for boehm you still need to explicitly turn off thread analysis. |
20:29:20 | FromGitter | <dandevelop> @Araq: are those strings needed in the release mode? |
20:30:30 | relax | @dandevelop: When you say, "Any text editor can be used," it makes me suspect you're inspecting the .c source files, not the actual binary |
20:30:37 | * | haha_ quit (Quit: haha_) |
20:30:55 | Araq | no, as I said, only enum field names are required for $ and there is a PR to change that iirc |
20:31:22 | Araq | relax: why? you can open binaries with text editors because "text" is a lie |
20:31:35 | Araq | there is only bytes. |
20:32:24 | FromGitter | <ephja> @dandevelop do you need conditional extension loading? |
20:32:42 | dom96 | dandevelop: I'm curious, why are you concerned about func/var names being present in the binary? |
20:33:11 | * | haha_ joined #nim |
20:33:19 | FromGitter | <dandevelop> @relax I am looking at the binary believe me :-) |
20:33:28 | relax | araq: agreed, just wanted to make sure |
20:33:58 | FromGitter | <Varriount> @dandevelop I'm not seeing any strings in my test code. I see the calls to the frame functions, but those are just dummy macros. |
20:34:26 | Araq | you might need to use some "strip" linker command |
20:34:41 | Araq | oh! |
20:35:03 | Araq | if you use .dynlib then yes, the string is generated as part of the loading sequence |
20:35:44 | * | yglukhov quit (Remote host closed the connection) |
20:37:01 | loc8 | dom96: So accessing a global variable from an async proc will cause this? |
20:37:15 | loc8 | Because it's trying to access stuff from another thread, right? |
20:37:36 | dom96 | accessing it from any proc will |
20:37:44 | dom96 | if you have threads enabled |
20:37:58 | dom96 | well, no I'm wrong, sorry, any `gcsafe` proc. |
20:38:38 | dom96 | And jester expects to get a gcsafe proc. |
20:40:35 | * | miran quit (Ping timeout: 240 seconds) |
20:41:47 | FromGitter | <dandevelop> @Varriount create a nim file with this content: |
20:41:50 | FromGitter | <dandevelop> proc SpecialFunctionName() = ⏎ ⏎ ```echo "Hello"``` ⏎ ⏎ SpecialFunctionName() [https://gitter.im/nim-lang/Nim?at=59a4800dba0f0f6e38f1c0b5] |
20:42:05 | FromGitter | <dandevelop> Save it as test.nim |
20:42:09 | FromGitter | <dandevelop> And then compile it |
20:42:11 | FromGitter | <dandevelop> nim c -d:release --opt:speed -d:noAutoGLerrorCheck --stackTrace:off --lineTrace:off --lineDir:off ./test.nim |
20:42:25 | FromGitter | <dandevelop> The open the binary in any text editor |
20:42:25 | FromGitter | <Varriount> What's with the define? |
20:43:24 | FromGitter | <dandevelop> You can leave that one out |
20:43:25 | FromGitter | <dandevelop> nim c -d:release --opt:speed --stackTrace:off --lineTrace:off --lineDir:off ./test.nim |
20:43:39 | FromGitter | <dandevelop> It was from another project |
20:43:58 | FromGitter | <dandevelop> Ok, once the binary is built |
20:44:13 | FromGitter | <dandevelop> You can open the binary in any text editor and search for the string: SpecialFunctionName |
20:47:45 | FromGitter | <Varriount> Dan: I see. Well running 'strip' seems to make the symbols go away. |
20:47:55 | Araq | dandevelop: that's a C compiler toolchain issue |
20:50:19 | Araq | use 'strip' or similar as varriount suggested |
20:50:19 | * | haha_ quit (Quit: haha_) |
20:51:43 | * | couven92 quit (Ping timeout: 248 seconds) |
20:52:29 | FromGitter | <dandevelop> @Araq strip works indeed for function names. what about fields in objects? |
20:54:25 | FromGitter | <Yardanico> So you want to make disassembling your file harder? |
20:54:43 | FromGitter | <Yardanico> *of your program |
20:55:24 | Araq | dandevelop: told you, that requires a compiler patch, but it is not hard |
20:56:01 | FromGitter | <dandevelop> Thank you @Araq. Is that something planned? |
20:56:30 | * | rosshadden quit (Quit: WeeChat 1.9) |
20:56:32 | dom96 | hrm, didn't answer my question I guess the answer is "I'm writing a virus" :P |
20:56:48 | FromGitter | <ephja> too many things in the pipeline |
20:57:12 | FromGitter | <Yardanico> Well you can also use xor'ed strings if you want to (I mean for string literals) |
20:58:27 | FromGitter | <Yardanico> But for virus - pls be careful, or antiviruses will detect any nim program :D |
20:58:56 | FromGitter | <Varriount> Oh gosh, imagine the GC being used as the hueristic. |
20:59:13 | Araq | dandevelop, no but PRs are welcome and it's not hard to do |
20:59:34 | FromGitter | <Yardanico> Also - would it be harder for someone to disassemble and understand nim than C (I mean both compiled to native)? |
20:59:40 | FromGitter | <dandevelop> @Araq: wish I could help with that but i don't know where to start |
21:00:10 | FromGitter | <dandevelop> @dom96: I worked in the antivirus industry for many years, I guess my brain is wired in a certain way :) Now seriously I am looking at protecting IP and binary size |
21:00:10 | Araq | compiler/ccgtypes.nim |
21:00:34 | dom96 | dandevelop: interesting :) |
21:00:55 | FromGitter | <Yardanico> @dandevelop also you may be interested in: |
21:01:49 | FromGitter | <Yardanico> https://forum.nim-lang.org/t/1305/1 |
21:02:25 | Araq | yardanico: probably about even, C is more cumbersome that means you need to wade through lots of asm's version of 'if (err) goto insanity' but Nim compensates this via its template expansions :P |
21:03:22 | FromGitter | <dandevelop> @dom96: if you are storing an user object with a password hash field and you check that in your app, you wouldn't want anyone to open your binary and simply look for the password field in your binary that is conveniently named: "password" as a member of the User object |
21:03:41 | FromGitter | <dandevelop> @dom96: that would make reversing even easier |
21:04:07 | dom96 | good point :) |
21:04:52 | Araq | really? I can just run the app and trace it when I type in some random password |
21:05:22 | FromGitter | <Yardanico> Well it would be the same in C, maybe you need to use an obfuscator? |
21:05:57 | FromGitter | <dandevelop> @Yardanico class members don't get stored as strings in the binary when using C afaik |
21:06:37 | FromGitter | <dandevelop> @Araq the password example is just an example. In general, field names make for easier reversing when they are visible in the binary |
21:07:02 | FromGitter | <Yardanico> @dandevelop well C doesn't have classes :) |
21:07:07 | FromGitter | <dandevelop> @Yardanico sorry, struct members, we are talking about C here |
21:07:16 | FromGitter | <Yardanico> Hmm, ok |
21:07:58 | FromGitter | <dandevelop> @Araq they also make binaries larger :D |
21:08:29 | Araq | as I said, PRs are welcome. |
21:09:00 | FromGitter | <dandevelop> @Araq ok, I will take a look at compiler/ccgtypes.nim |
21:09:01 | Araq | once you need deserialization, field names are hard to avoid though and C's solution ends up with field names too |
21:09:22 | Araq | it's just that you would need to write it manually |
21:09:38 | FromGitter | <dandevelop> @Araq true |
21:10:37 | FromGitter | <dandevelop> @Yardanico this link (https://forum.nim-lang.org/t/1305/1) looks interesting indeed :) |
21:12:29 | Araq | and as far as I can tell professionals trace the running program instead of looking at the assembly :P |
21:13:17 | FromGitter | <dandevelop> @Araq sometimes you can't trace the program under a debugger due to anti debugging mechanisms |
21:13:34 | * | relax quit (Ping timeout: 264 seconds) |
21:14:26 | Araq | how would that work? if all else fails, I can run it with an x86 emulator |
21:15:52 | FromGitter | <dandevelop> @Araq here is a link with more info: http://antukh.com/blog/2015/01/19/malware-techniques-cheat-sheet/ |
21:16:17 | Araq | ah, thanks |
21:18:06 | * | nsfw_ joined #nim |
21:18:11 | nsfw_ | hello |
21:18:24 | nsfw_ | may I ask somethinh as a complete newbie ? |
21:18:33 | FromGitter | <dandevelop> @Araq thank you for being so present in the community! |
21:19:13 | FromGitter | <Yardanico> nsfw_ |
21:19:25 | FromGitter | <Yardanico> Yes, you can |
21:20:21 | FromGitter | <Yardanico> Unless you use smuxi irc client :) |
21:22:28 | nsfw_ | okay: I can't understand about poll, asyncCheck etc etc - imagine you see something like asyncCheck connect(socket,...) and right after it something like socket.send(data) - wouldn't it be possible that send() be called before connect() finished it's work ? I ask because I'm reading Nim in Action |
21:22:44 | nsfw_ | its* work |
21:23:29 | dom96 | That's what 'await' is for :) |
21:23:33 | FromGitter | <Yardanico> Well if you need to wait for a coroutine, you should use await |
21:24:10 | Araq | dandevelop: you're welcome. it looks my "patched x86 emulator" would fare pretty well, avoiding most of the issues listed in your link :-) |
21:24:27 | nsfw_ | I don't need to: I see that in an example code that's correct but it bothers me |
21:24:39 | nsfw_ | because of this reasoning |
21:25:11 | FromGitter | <dandevelop> @Araq sounds good! Is the emulator available somewhere to try? |
21:25:13 | FromGitter | <Yardanico> Well asyncCheck is like running new coroutine independently |
21:26:13 | FromGitter | <Yardanico> I'm Python you have stuff like this as well |
21:26:25 | FromGitter | <Yardanico> Await as await, and |
21:27:40 | Araq | bochs and qemu come to mind, I don't understand |
21:27:58 | Araq | both open source, you can patch them for your cracker purposes |
21:28:14 | FromGitter | <Yardanico> ensure_future as asyncCheck |
21:28:19 | Araq | when I said "my patched x86 emulator" I was only talking about an idea |
21:28:36 | nsfw_ | but I can't see how it's different from a thread either (in brief I'm lost) |
21:28:41 | FromGitter | <dandevelop> @Araq oh, I thought you were talking about an existing project. my bad |
21:29:45 | FromGitter | <Yardanico> nsfw_: well you should read about async programming in general |
21:30:32 | nsfw_ | Yardanico: do you know good resources ? |
21:31:34 | * | PMunch quit (Quit: leaving) |
21:31:43 | FromGitter | <Yardanico> Sadly I don't :( because firstly I leaned async in python (by trial and error lol) |
21:32:21 | nsfw_ | I'm prcticing Python too so I will throw an eye |
21:32:37 | FromGitter | <dandevelop> @Araq any pointers for the function I should start with in compiler/ccgtypes.nim ? |
21:33:29 | Araq | genTypeInfo iirc |
21:33:41 | FromGitter | <dandevelop> @Araq thanks! |
21:33:42 | dom96 | nsfw_: which part is confusing you? |
21:34:41 | dom96 | the book has a table that explains the difference between 'asyncCheck' and 'await' |
21:34:49 | nsfw_ | I know |
21:35:37 | dom96 | I'm the author, I'd be happy to help |
21:36:12 | nsfw_ | This isn't what bothers me: it's just that I can't understand how poll, await and asyncCheck work together |
21:36:16 | nsfw_ | oh thanks |
21:36:32 | nsfw_ | in listing 3.36: |
21:36:49 | dom96 | Is the table not giving a sufficient explanation? :( |
21:37:41 | nsfw_ | nope cause it tells what there being used for but not what it does (at least in myview as a beginner in Nim) |
21:38:26 | nsfw_ | also I don't know anything about async programming maybe I should read about this before as suggested by Yardanico? |
21:39:25 | dom96 | That might make things clearer, if you want to do then go ahead. |
21:39:32 | dom96 | But if you're still stuck then let us know :) |
21:39:39 | dom96 | *to do that |
21:40:49 | nsfw_ | the fact is that there is a asyncCheck connect(socket,...) directly followed by asyncCheck socket.send(...) and I wonder if it could be possible for the second asyncCheck to be run before the previous one completes (or does it have to do with the behaviour of soket.send which would wait for a connecton ?) |
21:41:09 | dom96 | in listng 3.36? |
21:41:13 | dom96 | *listing |
21:41:15 | nsfw_ | 3.26* |
21:41:29 | nsfw_ | sorry - page 98 |
21:41:32 | * | couven92 joined #nim |
21:42:20 | dom96 | ahh yes. |
21:42:26 | dom96 | You are in fact correct. :) |
21:42:55 | dom96 | It's a bit of a bug with my implementation I suppose. But this can only happen if you start sending messages immediately. |
21:43:41 | dom96 | Sorry that it's confusing :\ |
21:44:02 | nsfw_ | anyway I understand it better now - thanks ! |
21:45:01 | dom96 | No problem :) |
21:46:25 | dom96 | I will create a FAQ on the wiki here: https://github.com/dom96/nim-in-action-code/wiki |
21:46:30 | dom96 | And add this as one of the questions :) |
21:48:27 | nsfw_ | and so the connect proedure is fully executed in the background ? or is it executed in the main thread and the 'rest' of the prgram is executed when connect is paused by await ? |
21:48:42 | nsfw_ | oh cool |
21:49:20 | FromGitter | <Yardanico> dom96: a side note - Wikipedia stopped creating new versions of pagecount archives for some reason |
21:49:34 | dom96 | That's fine. |
21:49:47 | dom96 | As long as the old ones are there :) |
21:49:58 | dom96 | I should probably keep a backup of them though |
21:50:24 | dom96 | nsfw_: It's executed when the event loop is `poll`-ed |
21:50:51 | FromGitter | <Yardanico> dom96: don't worry, they are |
21:50:51 | dom96 | Which actually only happens here: https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L54 |
21:51:03 | FromGitter | <Yardanico> https://lists.wikimedia.org/pipermail/analytics/2016-August/005339.html |
21:51:19 | dom96 | So if you type really fast, or pipe data into the process it may fail |
21:52:02 | * | enthus1ast- joined #nim |
21:52:57 | nsfw_ | okay thank you ! |
21:54:26 | nsfw_ | so it could be solved by placing another call to poll just before while true: ? |
21:55:08 | FromGitter | <Yardanico> Ah, it seems they replaced these files with web |
21:55:13 | FromGitter | <Yardanico> API |
21:55:39 | dom96 | https://github.com/dom96/nim-in-action-code/wiki/FAQ#confusing-use-of-asynccheck-in-listing-326 |
21:56:03 | dom96 | My FAQ entry explains the best solution |
21:56:13 | dom96 | A single `poll` doesn't guarantee that the connection will be completed |
21:58:23 | nsfw_ | thanks it's understood |
21:59:30 | dom96 | Awesome, let me know if you have any other questions :) |
22:01:46 | * | nsfw_ is now known as nsfw |
22:01:58 | * | nsfw is now known as nsfw_ |
22:06:47 | * | nsfw_ quit (Quit: Leaving.) |
22:07:43 | FromGitter | <Varriount> Anyone done any research on the best time to submit something to Hacker News? |
22:08:03 | dom96 | I've seen many articles about that |
22:09:04 | * | nsfw_ joined #nim |
22:09:21 | * | enthus1ast- quit (Ping timeout: 240 seconds) |
22:11:40 | * | enthus1ast- joined #nim |
22:12:27 | nsfw_ | dom96: forgot to ask: and we are sure that connect and send will be processed by poll in order in which we want them to be ? |
22:14:02 | dom96 | not necessarily |
22:14:13 | dom96 | But like I said, you're not sending things immediately. |
22:14:21 | dom96 | So it's only the `connect` call that is pending |
22:14:59 | dom96 | If you're writing it properly though, you should likely use `await`. |
22:15:48 | dom96 | oh wait |
22:15:53 | dom96 | I missed something. |
22:16:07 | dom96 | `connect` is actually defined above |
22:16:33 | dom96 | You need `asyncCheck` for this case |
22:16:47 | dom96 | Because the `connect` procedure includes a loop that reads the messages from the socket |
22:16:51 | dom96 | So it never completes |
22:21:25 | dom96 | So in order to really fix this you would need to separate the while loop into a separate procedure |
22:21:29 | dom96 | and call it with asyncCheck |
22:29:42 | nsfw_ | lurking in the doc and I see that asyncCheck takes a Future[T] as argument: so connect(_,_) is bel et bien executed - do poll trigger the execution of await'ed procedures instead ? - like this: the execution stop after echo("Connecting to"...) and is resumed by poll at the next line |
22:32:38 | dom96 | yep |
22:32:43 | dom96 | the execution stops at await |
22:33:13 | dom96 | unless `await connect` connects immediately, which can happen |
22:33:23 | nsfw_ | thaaaaaaaanks! I have the big picture |
22:33:51 | nsfw_ | immediatly ? how is that possible |
22:36:28 | loc8 | Also, why do Nim programmers love to make operators so much? Why not `json.serialize({...})` instead of `%*{...}`? |
22:36:59 | loc8 | It's much more readable and less confusing. It's also easier to avoid conflicts |
22:39:06 | Araq | "serialize" is the wrong name for it |
22:40:45 | * | mahmudov joined #nim |
22:41:11 | Araq | %* applies % "deeply" and % is 'toJsonNode', in retrospect we could have used that, but *shrug*, common things deserve shortcuts |
22:43:10 | loc8 | I believe they deserve readable shortcuts, though |
22:43:32 | loc8 | Some things should be understandable without having the need to search in the docs |
22:44:59 | Araq | "toJson" is more common than "modulo" in many applications... |
22:48:28 | * | nsf quit (Quit: WeeChat 1.9) |
22:48:45 | * | loc8_ joined #nim |
22:51:06 | * | loc8 quit (Ping timeout: 252 seconds) |
22:53:35 | * | enthus1ast- quit (Ping timeout: 240 seconds) |
22:55:28 | * | vendethiel- quit (Ping timeout: 240 seconds) |
22:57:17 | dom96 | There is a good reason why %* is used IMO |
22:57:25 | dom96 | It stems from the reason that `%` was chosen |
22:57:57 | dom96 | You don't want to have to write toJsonNode{"field": toJsonNode(5), "field2": toJsonNode(4.5)} |
22:57:58 | dom96 | Do you ? |
22:58:08 | dom96 | So `%` was used |
22:58:14 | dom96 | and then `%*` is only natural |
23:00:31 | * | enthus1ast- joined #nim |
23:01:22 | * | rauss joined #nim |
23:02:42 | FromGitter | <ephja> it won't be that verbose if you have another name for the macro |
23:02:45 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:03:08 | FromGitter | <ephja> isn't it only the prefix that needs to be changed? |
23:03:22 | * | gangstacat joined #nim |
23:07:56 | FromGitter | <barcharcraz> Wrote the first nim code that'll be used at my job today! |
23:10:06 | dom96 | :D |
23:12:29 | FromGitter | <barcharcraz> It's actually amazing how productive nim is even when I'm pretty much just calling out to C |
23:21:14 | * | nsfw_ left #nim (#nim) |
23:25:05 | * | loc8_ quit (Ping timeout: 240 seconds) |
23:25:24 | FromGitter | <FridgeSeal> Same: I'm attempting to re-write some python lambda functions in Nim, it's going well so far (admittedly my functions are pretty simple) |
23:26:04 | * | loc8_ joined #nim |
23:27:59 | * | couven92 quit (Read error: Connection reset by peer) |
23:30:14 | * | rauss quit (Quit: WeeChat 1.9) |
23:35:13 | loc8_ | It does make sense, yes |
23:35:20 | loc8_ | It feels a bit weird though |
23:35:34 | loc8_ | Same thing with `marshal` using `$$` for their serializing procedure |
23:36:22 | * | sz0 joined #nim |
23:38:20 | Demos[m] | Side note: my code for work is actually hard real time |
23:39:02 | * | fridgeseal joined #nim |
23:39:17 | Demos[m] | Well sorta. It's controlling cameras that must be synchronized to like the nanosecond |
23:59:27 | * | Sentreen quit (Ping timeout: 248 seconds) |