00:02:51 | dom96 | awesome :) |
00:03:24 | dom96 | You might also wish to try separating this code, you're mixing a lot of different things here, including threads which might be to blame for the issues. |
00:04:14 | FromGitter | <xmonader> yeah that's my main suspect right now :D :D |
00:06:56 | FromGitter | <xmonader> @dom96, You were right. I moved the async code part to another file compiled and ran successfully |
00:07:41 | * | Jesin quit (Quit: Leaving) |
00:09:39 | FromGitter | <xmonader> froze back again :S |
00:14:52 | dom96 | hopefully you'll figure it out |
00:14:55 | dom96 | I'm afraid I must sleep now |
00:14:57 | dom96 | good night |
00:15:11 | FromGitter | <xmonader> Good night ^_^ |
00:27:12 | * | mahtob joined #nim |
00:30:23 | * | mahmudov quit (Ping timeout: 248 seconds) |
00:33:11 | * | mahsav joined #nim |
00:38:10 | * | loc8 joined #nim |
00:40:39 | * | loc8_ quit (Ping timeout: 240 seconds) |
01:03:42 | * | relax quit (Ping timeout: 252 seconds) |
01:04:52 | * | chemist69 quit (Ping timeout: 246 seconds) |
01:17:36 | * | chemist69 joined #nim |
01:19:28 | * | Matthias247 quit (Read error: Connection reset by peer) |
02:01:44 | * | gangstacat quit (Quit: Leaving) |
02:02:30 | * | chemist69 quit (Ping timeout: 240 seconds) |
02:04:18 | * | loc8_ joined #nim |
02:06:57 | * | loc8 quit (Ping timeout: 260 seconds) |
02:16:45 | * | chemist69 joined #nim |
02:23:03 | * | dddddd quit (Remote host closed the connection) |
02:29:23 | loc8_ | Uh, I'm having a problem with sockets |
02:29:56 | loc8_ | I'm connecting to a telnet server and using `Socket.recv` to fetch data, 1 byte at a time |
02:30:27 | loc8_ | Looping until there's no more data (the call returns `0`) |
02:30:40 | loc8_ | The thing is: The call doesn't seem to return 0 even when there's no more data |
02:30:52 | loc8_ | If I set the timeout to -1 it will just hang there |
02:31:10 | loc8_ | Does it need a timeout? |
02:32:48 | loc8_ | I'm pretty sure it should be able to determine the EOF without a timeout |
02:34:00 | * | loc8_ is now known as l0c8 |
02:51:33 | * | loc8 joined #nim |
02:53:42 | * | l0c8 quit (Ping timeout: 252 seconds) |
03:01:21 | thomasross | is there a way to update a value in a table from a for loop? |
03:01:44 | thomasross | do i need to use a different iterator? right now i'm doing for k, v in table: table.someprop = 1 |
03:05:59 | thomasross | oh, got it, just needed to use mpairs() |
03:19:27 | * | vivus quit (Quit: Leaving) |
03:23:10 | * | loc8_ joined #nim |
03:23:31 | * | pilne quit (Quit: Quitting!) |
03:25:41 | * | loc8 quit (Ping timeout: 240 seconds) |
03:28:19 | loc8_ | Oh well, looks like I have to parse the `IAC GA` to stop trying to read from the socket |
03:35:32 | * | endragor joined #nim |
03:41:01 | thomasross | is it possible to pass by reference to an async proc? i'm just getting illegal capture errors |
04:06:29 | * | def-pri-pub joined #nim |
04:06:29 | * | def-pri-pub quit (Changing host) |
04:06:29 | * | def-pri-pub joined #nim |
04:14:35 | * | mwbrown quit (Ping timeout: 240 seconds) |
04:15:00 | * | mwbrown joined #nim |
04:32:09 | * | def-pri-pub quit (Quit: leaving) |
05:03:18 | * | francisl joined #nim |
05:12:57 | loc8_ | Can anyone give me some clarity on why the socket is behaving like that? |
05:13:29 | loc8_ | If I try to `recv(10)` on a stream that has less than 10 bytes of data buffered, it will hang |
05:15:01 | loc8_ | How can I make it simply receive the 9 bytes and stop? |
05:46:30 | * | francisl quit (Quit: francisl) |
05:57:57 | * | loc8 joined #nim |
06:00:31 | * | loc8_ quit (Ping timeout: 248 seconds) |
06:27:11 | * | mahtob quit (Remote host closed the connection) |
06:45:46 | * | rauss quit (Quit: WeeChat 1.9) |
06:49:02 | * | haha_ joined #nim |
07:04:47 | FromGitter | <Yardanico> thomasross: no afaik |
07:04:52 | FromGitter | <Yardanico> But you can make |
07:05:03 | FromGitter | <Yardanico> Your object a ref object |
07:16:23 | * | yglukhov joined #nim |
07:27:01 | * | miran joined #nim |
07:33:33 | * | aziz joined #nim |
07:33:50 | * | aziz quit (Client Quit) |
07:34:44 | FromGitter | <Yardanico> loc8_ recv(9).:( |
07:34:55 | FromGitter | <Yardanico> recv(9) ? :) |
07:45:31 | SusWombat | Nim is going to be always a little bit slower then c right? cause of the "boilerplate"? |
07:45:54 | SusWombat | code directly written in c i mean |
07:46:50 | * | BigEpsilon joined #nim |
07:49:51 | SusWombat | nvm forgot to make a release build ... |
07:50:16 | * | Yardanico joined #nim |
07:51:39 | Yardanico | dom96, really? https://gist.github.com/dom96/da2d4dead6fb00b71312 |
07:51:46 | Yardanico | maybe we can remove this link ? :D |
07:55:05 | Yardanico | because it doesn't count gitter users :) |
07:55:43 | Yardanico | and it seems strange that user record wasn't changed in two years |
07:57:41 | * | haha_ quit (Quit: haha_) |
08:13:01 | * | Arrrr joined #nim |
08:13:01 | * | Arrrr quit (Changing host) |
08:13:01 | * | Arrrr joined #nim |
08:18:13 | * | Pisuke joined #nim |
08:20:05 | * | MyMind quit (Ping timeout: 240 seconds) |
08:21:26 | * | claudiuinberlin joined #nim |
08:22:43 | * | SusWombat_ joined #nim |
08:25:21 | * | SusWombat quit (Ping timeout: 252 seconds) |
08:36:51 | * | BigEpsilon quit (Remote host closed the connection) |
08:37:08 | * | BigEpsilon joined #nim |
09:01:28 | * | thomasross quit (Remote host closed the connection) |
09:01:52 | * | thomasross joined #nim |
09:05:37 | * | Arrrr quit (Ping timeout: 248 seconds) |
09:08:42 | * | Arrrr joined #nim |
09:08:42 | * | Arrrr quit (Changing host) |
09:08:42 | * | Arrrr joined #nim |
09:22:59 | FromGitter | <mratsim> @SusWombat => No, in many benchmarks, naive Nim is faster than naive C. |
09:25:53 | FromGitter | <Yardanico> he said "nvm forgot to make a release build" :D |
09:36:35 | * | Matthias247 joined #nim |
09:37:20 | FromGitter | <mratsim> btw @dom96, I use a package/src/*.nim directory structure for my source files but the “src” gets removed on nimble install. Nimble use the same and the following line as a workaround https://github.com/nim-lang/nimble/blob/master/nimble.nimble#L5. I think it would be much easier to have the option to keep the “src” structure, especially regarding “includes”, what do you think? |
09:42:04 | Yardanico | mratsim: also this might help youhttps://gist.github.com/stisa/09474a952a420448778685507d3fbd51 |
09:42:13 | Yardanico | https://gist.github.com/stisa/09474a952a420448778685507d3fbd51 |
09:48:59 | * | nsf joined #nim |
09:55:10 | * | Vladar joined #nim |
10:02:04 | * | couven92 joined #nim |
10:26:05 | * | ShalokShalom_ joined #nim |
10:29:06 | * | ShalokShalom quit (Ping timeout: 252 seconds) |
10:40:08 | * | miran quit (Ping timeout: 240 seconds) |
10:46:48 | * | vlad1777d joined #nim |
11:19:16 | * | dddddd joined #nim |
11:29:26 | Yardanico | wow |
11:29:59 | Yardanico | even if there's not that much comments in the compiler, I still can fix some simple errors |
11:30:04 | Yardanico | for example this https://github.com/nim-lang/Nim/issues/5870 |
11:32:53 | Yardanico | Araq, where do I put a test-case for https://github.com/nim-lang/Nim/issues/5870 ? |
11:33:01 | Yardanico | there are many folders in "tests" :) |
11:34:28 | Yardanico | ah |
11:34:29 | Yardanico | ccgbugs |
11:35:46 | Yardanico | or misc |
11:35:55 | * | chemist69 quit (Ping timeout: 255 seconds) |
11:38:58 | * | ShalokShalom_ is now known as ShalokShalom |
11:43:09 | * | haha_ joined #nim |
11:50:00 | * | chemist69 joined #nim |
11:53:35 | * | haha_ quit (Ping timeout: 248 seconds) |
11:55:14 | * | mahmudov joined #nim |
11:59:11 | * | PMunch joined #nim |
12:27:17 | * | yglukhov quit (Remote host closed the connection) |
12:27:56 | * | nsf quit (Quit: WeeChat 1.9) |
12:29:23 | Yardanico | https://github.com/nim-lang/Nim/pull/6320 |
12:44:42 | PMunch | Hmm, the vim syntax plugin seems to not like the 0'u16 style of int literals |
12:44:51 | PMunch | It thinks it's the start of a string |
12:49:14 | * | gangstacat joined #nim |
12:55:22 | FromGitter | <ephja> PMunch: this plugin doesn't have the same issues I think https://github.com/baabelfish/nvim-nim |
12:55:27 | FromGitter | <ephja> other things are broken though |
12:56:00 | PMunch | Hmm, that appears to be a bit better all-round though.. |
12:56:07 | PMunch | What are the differences? |
12:56:23 | Yardanico | https://github.com/baabelfish/nvim-nim#caveats-will-be-fixed-asap |
12:56:30 | Yardanico | lol |
12:56:30 | Yardanico | Launching new nimsuggest for every completion |
12:57:20 | FromGitter | <ephja> I don't even know if suggestions worked for me |
12:57:51 | Yardanico | well yeah after you learn language and libraries you rarely need suggestions |
12:58:31 | Yardanico | also nim helps you to write code a bit faster with style insensitivity |
12:58:44 | Yardanico | you don't need to remember if some proc is camelCase or snake_case |
12:59:01 | PMunch | Hmm, nvim seems to just not highlight '' strings at all... |
12:59:26 | FromGitter | <ephja> would full insensitivity be so bad? |
12:59:37 | Yardanico | what do you mean by full insensitivity? |
12:59:48 | PMunch | I'm guessing Class vs. class |
13:00:26 | PMunch | Or maybe While vs. while? |
13:00:28 | FromGitter | <ephja> case sensitviity is used for the first character |
13:00:30 | PMunch | That would be interesting |
13:00:41 | Yardanico | While True: |
13:00:49 | Yardanico | lol, looks like visual basic?? |
13:00:57 | PMunch | Wh_ile T_rue: :P |
13:01:02 | Yardanico | :D |
13:01:16 | Yardanico | w_H_i_L_e t_R_u_E: |
13:01:29 | Yardanico | oh wait |
13:01:31 | Yardanico | this works |
13:01:34 | Yardanico | LOL |
13:01:42 | PMunch | What? |
13:01:44 | Yardanico | this works |
13:02:01 | Yardanico | it's a valid "while true" |
13:02:04 | FromGitter | <ephja> it's actually "style insensitive" |
13:02:26 | PMunch | Huh, so it is :S |
13:02:26 | Yardanico | but I doubt people would write code like this |
13:02:31 | Yardanico | only for obfuscating |
13:02:36 | PMunch | I thought it only applied to variable names |
13:02:52 | Yardanico | no |
13:02:57 | Yardanico | oh wait |
13:03:03 | Yardanico | I thought so |
13:03:09 | PMunch | It works for me |
13:03:39 | PMunch | But since the first letter is case sensitive it doesn't really have any practical purpose |
13:03:43 | Yardanico | yeah |
13:03:50 | PMunch | I could see people wanting to do "While True:" |
13:04:04 | FromGitter | <ephja> most code relies on similar conventions. it has mostly been helpful for me when interfacing with C code |
13:04:12 | Yardanico | well you can write "True" |
13:04:17 | Yardanico | just "const True* = true" |
13:04:29 | PMunch | Haha, of coure |
13:04:34 | PMunch | course* |
13:04:35 | Yardanico | and about while: maybe template? |
13:04:36 | Yardanico | wait a sec |
13:05:08 | PMunch | Yeah a template should work "template While(block:untyped):untyped = while: block |
13:05:18 | Yardanico | almost |
13:05:20 | PMunch | Oh wait, you'll need the statement as well :P |
13:05:32 | Yardanico | yes |
13:05:41 | Yardanico | https://gist.github.com/Yardanico/706e53f9413b8260e8d3dd4b56ee7d37 |
13:06:00 | Yardanico | and combine this with "end" syntax skin :D |
13:06:50 | * | relax joined #nim |
13:07:10 | PMunch | End syntax skin? |
13:07:15 | FromGitter | <faustinoaq> Hi Nim community, If you know some of spanish you can listen El Maratón Linuxero live now https://www.youtube.com/maratonlinuxero/live |
13:07:17 | Yardanico | well maybe I'm wrong |
13:07:36 | Yardanico | faustinoaq: I don't know it sadly :) |
13:07:46 | PMunch | https://www.rosettacode.org/wiki/Loops/Do-while#Nim |
13:07:52 | PMunch | Some template work in action :P |
13:08:18 | * | Sembei joined #nim |
13:08:22 | Yardanico | well someone should edit many nim solutions on rosetta :) |
13:08:28 | Yardanico | many of them contain typeless arguments in procs |
13:08:36 | FromGitter | <faustinoaq> Yardanico, Don't worry |
13:09:02 | PMunch | They're talking about Nim? |
13:09:21 | Yardanico | PMunch, I guess about Linux |
13:09:25 | Yardanico | "linuxero" |
13:09:40 | PMunch | Yeah, but they could have a topic of Nim at the moment |
13:09:58 | * | Pisuke quit (Ping timeout: 264 seconds) |
13:10:14 | Yardanico | PMunch, ah, there's a mention of "endX" skin |
13:10:17 | Yardanico | but it's not implemented |
13:10:19 | Yardanico | https://github.com/nim-lang/Nim/blob/a94a0f27f2252e06427364665e1cbb9a6bce5af7/compiler/syntaxes.nim |
13:12:00 | FromGitter | <faustinoaq> > They're talking about Nim? ⏎ ⏎ No, Mainly C && C++ but I'll try to mention Nim in the chat |
13:12:36 | PMunch | What? |
13:12:46 | PMunch | I didn't even know nim had syntax skins :S |
13:12:56 | Yardanico | PMunch, well they probably will be removed |
13:13:25 | PMunch | Still though, quite interesting |
13:13:36 | PMunch | I would like a tab skin :P |
13:13:46 | Yardanico | you can use tabs already |
13:13:48 | Yardanico | with filter |
13:13:51 | Yardanico | one sec :) |
13:13:52 | PMunch | I like the idea of one tab == one level of indentation |
13:14:04 | Yardanico | https://gist.github.com/Yardanico/1ff3181aaf28efada551713652c5eb13 |
13:14:11 | FromGitter | <abijahm> guy in generics what if i want to use a generic type without passing the type eg.. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ac0023bac826f05476456f] |
13:14:20 | PMunch | Then people can decide themselves how they want their indentation to look |
13:15:07 | PMunch | What is this sorcerous #? syntax Yardanico |
13:15:14 | Yardanico | PMunch, filters |
13:15:20 | Yardanico | https://nim-lang.org/docs/filters.html |
13:15:21 | PMunch | Never seen it before :P |
13:15:26 | Yardanico | https://nim-lang.org/docs/filters.html#available-filters-replace-filter |
13:16:05 | FromGitter | <Yardanico> @abijahm you can't |
13:16:12 | FromGitter | <Yardanico> because Nim doesn't know if it would be Hut or Mansion |
13:17:01 | FromGitter | <Yardanico> Well nim always tries to resolve implicit generics |
13:17:05 | FromGitter | <Yardanico> but it can't do it all times |
13:17:43 | Yardanico | PMunch, also there's already "end" syntax |
13:17:51 | Yardanico | https://nim-lang.org/docs/filters.html#available-filters-stdtmpl-filter |
13:17:59 | Yardanico | Because indentation-based parsing is not suited for a templating engine, control flow statements need end X delimiters. |
13:18:14 | PMunch | Huh, interesting |
13:18:25 | PMunch | Oh well, I'm off for a little while. I'll be back |
13:18:59 | FromGitter | <Yardanico> @abijahm generics are fully static |
13:19:24 | FromGitter | <Yardanico> you can make User constructor |
13:19:29 | FromGitter | <Yardanico> or NoHouse type |
13:20:03 | FromGitter | <abijahm> thanks |
13:20:31 | Yardanico | well generally you need to create a proc like "newUser" |
13:20:40 | Yardanico | it's not mandatory |
13:21:05 | * | dddddd quit (Ping timeout: 248 seconds) |
13:21:59 | FromGitter | <Yardanico> @abijahm I'm talking about this: https://gist.github.com/Yardanico/3297222f32cbf932e675c4def451212b |
13:22:07 | FromGitter | <Yardanico> so you don't need to specify generic type by yourself |
13:22:56 | * | haha__ joined #nim |
13:23:30 | * | endragor quit (Remote host closed the connection) |
13:23:57 | * | endragor joined #nim |
13:25:47 | * | haha__ quit (Quit: haha__) |
13:28:24 | * | endragor quit (Ping timeout: 252 seconds) |
13:28:54 | * | haha_ joined #nim |
13:34:27 | * | dddddd joined #nim |
13:35:29 | * | haha_ quit (Ping timeout: 248 seconds) |
13:48:28 | * | BigEpsilon quit (Ping timeout: 240 seconds) |
13:48:47 | * | relax quit (Ping timeout: 248 seconds) |
13:52:30 | dom96 | hello guys |
13:52:41 | Yardanico | dom96, hi |
13:52:51 | Yardanico | oh wait |
13:52:53 | Yardanico | nvm |
13:53:30 | * | relax joined #nim |
13:54:45 | Yardanico | dom96, ehm, why your ip is... strange? |
13:55:16 | dom96 | Because I'm not identified |
13:55:24 | * | dom96 quit (Changing host) |
13:55:24 | * | dom96 joined #nim |
13:55:30 | Yardanico | ah, ok :D |
13:55:30 | dom96 | Fixed :) |
13:55:46 | dom96 | Also I need to move the BNC to our new server |
13:55:50 | dom96 | it's still running on the old one |
13:56:04 | couven92 | BNC? |
13:57:19 | dom96 | look it up |
13:57:32 | Yardanico | ah |
13:57:35 | Yardanico | bouncer? |
13:57:41 | Yardanico | https://en.wikipedia.org/wiki/BNC_(software) |
13:59:48 | dom96 | yep |
14:01:25 | * | def-pri-pub joined #nim |
14:01:25 | * | def-pri-pub quit (Changing host) |
14:01:25 | * | def-pri-pub joined #nim |
14:03:03 | * | gokr joined #nim |
14:03:35 | * | nsf joined #nim |
14:03:44 | * | ShalokShalom quit (Read error: No route to host) |
14:03:52 | * | ShalokShalom joined #nim |
14:12:41 | Yardanico | dom96, lol https://github.com/nim-lang/Nim/issues/6319#issuecomment-326807193 |
14:12:47 | Yardanico | I reproduced it 0_0 |
14:14:09 | dom96 | Yep, it's a gotcha |
14:14:11 | dom96 | replied |
14:14:25 | * | miran joined #nim |
14:14:48 | Yardanico | ah, I didn't knew about it |
14:14:55 | Yardanico | does .nims config have the same behaviour? |
14:15:36 | * | haha_ joined #nim |
14:17:41 | * | Vladar quit (Quit: Leaving) |
14:18:21 | dom96 | probably |
14:18:32 | dom96 | might be something to try |
14:19:37 | * | relax quit (Ping timeout: 260 seconds) |
14:20:35 | * | xet7 quit (Ping timeout: 240 seconds) |
14:22:27 | * | yglukhov joined #nim |
14:26:38 | * | yglukhov quit (Ping timeout: 240 seconds) |
14:34:40 | FromGitter | <abijahm> guys how would you copy values of a tuple to another |
14:36:01 | Yardanico | your tuples have the same type? |
14:36:18 | Yardanico | if so, just "anothertuple = mytuple" if you've already defined anothertuple and tuple |
14:38:05 | * | haha_ quit (Ping timeout: 240 seconds) |
14:41:14 | * | BigEpsilon joined #nim |
14:41:33 | * | def-pri-pub quit (Ping timeout: 252 seconds) |
14:42:27 | dom96 | I really wish VS Code would show a little spinner when it runs `nim check` |
14:42:34 | dom96 | I wonder if that's something the plugin could do |
14:44:52 | * | solitudesf joined #nim |
14:46:01 | dom96 | I love this: https://news.ycombinator.com/item?id=15160347 |
14:46:21 | dom96 | Back when C++ was starting out people called Bjarne's compiler a "pre-processor" and he didn't like it either. |
14:47:35 | * | dddddd quit (Ping timeout: 240 seconds) |
14:47:41 | * | SgtLion joined #nim |
14:50:55 | * | solitudesf quit (Quit: Leaving) |
14:51:13 | * | solitudesf joined #nim |
14:55:51 | FromGitter | <ephja> Yardanico: correct |
14:56:31 | FromGitter | <ephja> a distinct type can be introduced with the 'distinct' keyword, but I dunno if it makes any sense for tuples |
14:56:57 | dom96 | https://github.com/nim-lang/Nim/issues/2819#issuecomment-326809808 |
15:03:53 | * | dddddd joined #nim |
15:05:17 | * | yglukhov joined #nim |
15:08:46 | * | rauss joined #nim |
15:14:30 | * | yglukhov quit (Remote host closed the connection) |
15:18:59 | * | nsf quit (Quit: WeeChat 1.9) |
15:23:46 | * | loc8_ joined #nim |
15:23:58 | * | solitudesf quit (Remote host closed the connection) |
15:26:25 | * | loc8 quit (Ping timeout: 248 seconds) |
15:26:55 | * | Calinou quit (Ping timeout: 248 seconds) |
15:32:19 | * | Calinou joined #nim |
15:35:29 | * | Arrrr quit (Ping timeout: 248 seconds) |
15:39:17 | FromGitter | <BigEpsilon> @Araq, can I ask you a question ? |
15:39:18 | * | Calinou quit (Ping timeout: 252 seconds) |
15:39:20 | * | haha_ joined #nim |
15:39:40 | FromGitter | <BigEpsilon> I'm working on the reorder pragma |
15:40:06 | * | Calinou joined #nim |
15:40:45 | FromGitter | <BigEpsilon> I'm using a very simple approach to solve the problem of typeSections, VarSections ... |
15:41:49 | FromGitter | <BigEpsilon> It works find but I want to known from you if my approach is good before doing the PR ( And check another thing) |
15:42:57 | * | dddddd quit (Ping timeout: 248 seconds) |
15:43:58 | * | xet7 joined #nim |
15:44:20 | FromGitter | <BigEpsilon> with that I'm able to compile that https://gist.github.com/ad73ebfacf130b3a8b86145bc70e83af |
15:49:12 | Yardanico | well I don't really think this is a good feature. I don't know the language where compiler automatically changes places where variables are declared |
15:49:41 | Yardanico | IMO |
15:50:31 | Yardanico | it would be harder to read code that uses stuff like that |
15:51:13 | FromGitter | <BigEpsilon> In alot of languages, the order of declaration (at the top level, not in functions) does not count. |
15:51:46 | FromGitter | <BigEpsilon> It make it easier to organize the code. |
15:52:16 | Yardanico | I don't really know languages, can you please name a few? |
15:52:30 | Yardanico | I'm fine with reordering "type" sections |
15:52:52 | FromGitter | <BigEpsilon> like putting the little utility functions at the and of the file, and the main "important" functions at the top |
15:53:23 | Yardanico | well reorder pragma does that already AFAIK |
15:53:27 | FromGitter | <BigEpsilon> Golang is like that |
15:53:47 | FromGitter | <BigEpsilon> Yes, but reorder pragma is not complete |
15:53:56 | loc8_ | Yardanico, no, I mean that if I try to read more data than there is on the socket buffer, it hangs |
15:54:01 | FromGitter | <BigEpsilon> And I'm working on completing it |
15:54:10 | loc8_ | In Python, for example, it would return the data that it could get |
15:55:08 | Yardanico | well I don't really know |
15:56:08 | * | dddddd joined #nim |
15:57:26 | dom96 | Yardanico: Most languages do this |
15:58:02 | dom96 | BigEpsilon: did you see how the noForward pragma works? |
15:58:56 | FromGitter | <BigEpsilon> No I did not |
15:59:01 | FromGitter | <BigEpsilon> should I ? |
15:59:08 | * | loc8 joined #nim |
15:59:13 | dom96 | You're working on the same thing so it might be a good idea |
15:59:58 | FromGitter | <BigEpsilon> Its different than the reorder pragma ? |
16:01:27 | FromGitter | <mratsim> Is there a nim branch with VTable, vtref, vtptr? |
16:02:05 | * | loc8_ quit (Ping timeout: 240 seconds) |
16:02:11 | * | PMunch quit (Quit: leaving) |
16:02:32 | Yardanico | mratsim: IIRC there's a possibility to use "vtref" and "vtptr" with concepts |
16:02:35 | Yardanico | https://nim-lang.org/docs/manual.html#generics-vtable-types |
16:02:42 | Yardanico | maybe this is not that you're talking about |
16:02:52 | Yardanico | Any concept type can be turned into a VTable type by using the vtref or the vtptr compiler magics. |
16:02:56 | FromGitter | <mratsim> yes it is but afaik it’s not implemented yet |
16:03:16 | Yardanico | ah, yes |
16:04:40 | * | endragor joined #nim |
16:08:59 | * | endragor quit (Ping timeout: 255 seconds) |
16:18:31 | * | def-pri-pub joined #nim |
16:23:51 | * | nsf joined #nim |
16:29:18 | FromGitter | <ephja> I wonder which bleeding edge Linux distro I should use this time. Arch again perhaps |
16:29:52 | FromGitter | <k0pernicus> Arch is my favorite one ;-) |
16:38:46 | FromGitter | <mratsim> Arch is awesome. I’ve been using it for 8+ years |
16:40:23 | FromGitter | <mratsim> I used Gentoo as well in the past but compiling world on a core 2 duo laptop got tiresome (especially web browsers, gcc and java apps) |
16:40:46 | * | Snircle quit (Ping timeout: 246 seconds) |
16:43:07 | dom96 | Anyone want to add Nim here? https://github.com/tbrand/which_is_the_fastest :) |
16:44:45 | * | dddddd quit (Ping timeout: 252 seconds) |
16:45:39 | Yardanico | well jester? |
16:46:16 | dom96 | asynchttpserver |
16:46:26 | Yardanico | dom96, ehm |
16:46:27 | dom96 | ideally |
16:46:30 | Yardanico | Measuring response times for each framework (middleware). Each framework has to have two features; routing and parsing path parameters. |
16:46:59 | dom96 | jester then I guess |
16:47:32 | Yardanico | and we can't set number of threads |
16:47:45 | Yardanico | I mean there's no multi-threaded web server for nim :) |
16:48:19 | dom96 | Crystal is single threaded too |
16:48:35 | Yardanico | also python's japronto is fastest here |
16:48:39 | Yardanico | why? because it's implemented in C |
16:48:44 | Yardanico | using picohttpparser |
16:48:59 | Yardanico | and also it's "cheating" |
16:49:01 | dom96 | you can use a trick to scale to multiple cores: SO_REUSE_PORT + launch multiple processes. |
16:49:16 | Yardanico | japronto is fast because of http pipelining |
16:49:22 | Yardanico | which isn't supported in browsers :) |
16:49:34 | federico3 | mixing together both single and multithreaded ones is misleading |
16:49:58 | dom96 | lol, these benchmarks are bullshit anyway |
16:50:19 | ipjk | aren't most benchmarks? |
16:50:45 | dom96 | true that |
16:51:45 | Yardanico | well it actually seems we can use asynchttpserver here |
16:51:47 | federico3 | some are successfully used to optimize stuff, so no |
16:52:05 | ipjk | therby the use "most" |
16:53:26 | * | Trustable joined #nim |
16:57:42 | * | dddddd joined #nim |
16:58:12 | loc8 | Is there a way to check if stdin has data? Like `!feof(stdin)`? |
17:00:50 | * | Calinou quit (Ping timeout: 240 seconds) |
17:00:51 | Yardanico | loc8, how does it work? |
17:01:08 | loc8 | How does what work? |
17:01:11 | Yardanico | loc8, !feof |
17:01:25 | dom96 | loc8: for what purpose do you want to check this? |
17:01:33 | FromGitter | <krux02> loc8: you can call C functions |
17:01:44 | FromGitter | <krux02> so there is a way to check that |
17:02:06 | Yardanico | maybe in Nim there's a way too? |
17:02:16 | FromGitter | <krux02> there should |
17:02:33 | loc8 | `feof` returns non-zero when the EOF indicator associated with the stream is set, otherwise, it returns zero |
17:02:59 | dom96 | that's not checking if stdin has data, it's checking whether EOF has been reached |
17:03:02 | dom96 | Which is slightly different |
17:03:09 | loc8 | I have a socket IO loop where I read from the socket and want to send data from the stdin |
17:03:10 | FromGitter | <krux02> https://nim-lang.org/docs/system.html#endOfFile,File |
17:03:14 | loc8 | I could use select in C |
17:03:24 | loc8 | But that wouldn't work with Windows iirc |
17:03:36 | dom96 | You want to be asynchronous right? |
17:03:52 | loc8 | That'd be good |
17:03:57 | Yardanico | loc8, krux02 gave you a link |
17:03:57 | dom96 | Use the same approach that I've used in my chat app: https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim |
17:04:08 | dom96 | If I had a dollar for the amount of times I suggested this now... |
17:04:20 | loc8 | krux02, I took a look at that. Didn't quite work |
17:04:32 | FromGitter | <krux02> well it should |
17:05:11 | * | Calinou joined #nim |
17:11:05 | * | Calinou quit (Ping timeout: 240 seconds) |
17:12:39 | * | Calinou joined #nim |
17:19:49 | def-pri-pub | zacharycarter: Not sure if you're here right now, but I |
17:20:05 | def-pri-pub | if you could review those things I posted yesterday that'd help unblock me a little. |
17:20:07 | * | def-pri-pub quit (Quit: leaving) |
17:23:38 | FromGitter | <abijahm> can one return from templates |
17:23:57 | Yardanico | no |
17:24:00 | Yardanico | they're "templates" |
17:24:16 | Yardanico | everything you write in templates would be directly inserted in a place where you called your template |
17:24:28 | Yardanico | well not always |
17:24:36 | Yardanico | they have some additional features too |
17:25:38 | Yardanico | abijahm, what do you want to do? |
17:27:53 | Yardanico | ah |
17:28:05 | Yardanico | if you want to put "return" inside of template to call this template in a proc - you can do that |
17:28:15 | Yardanico | so "return" would be directly inserted in your proc body |
17:28:51 | FromGitter | <abijahm> i want to create add values to a tuple ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ac3bd3bac826f054772342] |
17:29:24 | FromGitter | <abijahm> i want to get the newuser |
17:30:09 | FromGitter | <Yardanico> well you can add another argument "retVar" to your template |
17:30:14 | FromGitter | <Yardanico> and then use template like that |
17:30:37 | FromGitter | <Yardanico> ```add(user, val, newuser) ⏎ # you can do something with newuser``` [https://gitter.im/nim-lang/Nim?at=59ac3c3d66c1c7c4770f28fc] |
17:30:54 | FromGitter | <Yardanico> well I can't explain it |
17:31:06 | FromGitter | <Yardanico> I don't understand what's your goal |
17:31:13 | * | loc8_ joined #nim |
17:31:48 | dom96 | Nimble 0.8.8 is here https://github.com/nim-lang/nimble/blob/master/changelog.markdown#088---03092017 :) |
17:32:06 | FromGitter | <k0pernicus> Youhou! :-) |
17:33:35 | * | loc8 quit (Ping timeout: 255 seconds) |
17:34:19 | FromGitter | <ephja> @Yardanico I think he wants to define a tuple type with additional fields |
17:34:33 | FromGitter | <ephja> @abijahm I think you need to use a macro |
17:34:48 | FromGitter | <abijahm> @ephja yah that what i want to do |
17:37:28 | * | haha_ quit (Ping timeout: 240 seconds) |
17:37:52 | * | _Moz_ joined #nim |
17:40:56 | * | _Moz_ quit (Remote host closed the connection) |
17:44:04 | Yardanico | wow |
17:44:09 | Yardanico | "using" is actually a cool thing |
17:44:27 | Yardanico | I want to ask this scary question - when "using" will be "normal", e.g. not experimental? |
17:45:34 | crem | Gibt es eine Art von "tuple assigment"? Etwa "let (id, desc) = line.split(maxsplit=1)" ? |
17:45:44 | Yardanico | crem, yes, you can use it like that |
17:45:55 | Yardanico | but I don't understand what you've written :) |
17:46:11 | Yardanico | I only understood "tuple assigment" and code snippet |
17:46:50 | FromGitter | <ephja> @abijahm The simplest way to add fields would be to use inheritance (with or without references) |
17:46:50 | crem | Но оно так не компилится. Говорит 'tuple' expected. |
17:47:16 | FromGitter | <ephja> this might help you write a macro that takes a tuple https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/#macros |
17:47:18 | Yardanico | crem, it wouldn't compile, yes |
17:47:22 | Yardanico | because line.split returns a sequence |
17:47:24 | Yardanico | not a tuple |
17:47:45 | Yardanico | even if you've specified "maxsplit" |
17:48:15 | crem | So, is there a way to convert a sequence to a tuple? It isn't possible to write it shorter than in 3 lines, is it? |
17:48:33 | Yardanico | crem, I have an "unpack" macro |
17:49:13 | Yardanico | crem, https://gist.github.com/Yardanico/3ed3f8d8b6ccd070afd67e8bd26f2914 |
17:49:16 | Yardanico | simple macro |
17:49:26 | Yardanico | so yeah, it's more than 3 lines but you can reuse it |
17:49:29 | dom96 | The length of a sequence is only known at run-time |
17:49:38 | dom96 | Whereas the structure of a tuple must be known at compile-time |
17:49:49 | Yardanico | dom96, well I actually think that it's possible to make line.split generic |
17:49:58 | Yardanico | but this would break older code |
17:50:05 | Yardanico | I mean it can return either seq or tuple |
17:50:07 | crem | Well, I'm fine with compile-time check and crash on size mismatch. |
17:50:19 | Yardanico | (tuple if maxsplit is specified) |
17:50:40 | crem | Would tuple to seq assigment work? |
17:50:57 | Yardanico | crem, AFAIK no |
17:51:20 | FromGitter | <k0pernicus> @dom96 Simple question on choosenim, is the tool detects if this is the first installation of nim, or not? For example, trying to call the compiler once, or to detect if a nim compiler is « available », something like that… ? |
17:51:31 | Yardanico | it doesn't detect it I think |
17:51:41 | dom96 | it doesn't |
17:52:47 | Yardanico | well I don't use choosenim because choosenim clones nim repo on every devel update, and also sometimes (rarely, but still) I need to hack the compiler |
17:53:47 | FromGitter | <k0pernicus> Ok - no problem if I implement a procedure which detect if this is the first installation? In order to let choosenim manages itself the switch. |
17:54:13 | dom96 | k0pernicus: please don't complicate things |
17:54:13 | Yardanico | contributions are welcome in all projects :) |
17:54:15 | dom96 | a flag is fine |
17:54:39 | * | haha_ joined #nim |
17:54:43 | FromGitter | <k0pernicus> Ok - so the flag will be managed by the installation script later, for example? |
17:55:14 | dom96 | yep |
18:01:52 | crem | Is there a canonical way to reduce bolierplate in "simple assignment" type of "constructor function". I.e. is that a canonical way to write a newObj function: https://pastebin.com/tv0QfcM4 ? |
18:02:29 | crem | Ah, I could do just {} initialization.. |
18:02:31 | crem | But |
18:02:39 | crem | I also need new(). |
18:02:45 | Yardanico | you don't |
18:02:50 | * | Senketsu joined #nim |
18:03:00 | * | Senketsu quit (Remote host closed the connection) |
18:03:10 | Yardanico | crem, you don't need it |
18:03:37 | Yardanico | just WhateverObj(someId: someId, someIntField: someIntField, someTextField: someTextField) would do the job :) |
18:04:19 | crem | Ok, let me remember. A month ago I read all available nim documentation, and now I don't remember anything. I should have written some code.. |
18:05:22 | Yardanico | crem, well yeah, even if you read documentation you still need to write nim code |
18:05:29 | Yardanico | to actually understand how things work :) |
18:06:42 | Yardanico | crem, also (just a note) it's slightly better to use gist for code snippets - 1) it's integrated with gitter 2) it doesn't have ads |
18:07:01 | Yardanico | and Nim on gist is Nim |
18:07:10 | Yardanico | while pastebin still shows old nim name |
18:07:12 | Yardanico | (nimrod) |
18:07:59 | * | miran quit (Remote host closed the connection) |
18:08:32 | crem | Ok, will try it, thanks. Is there a way to dump an object (all fields of it, for debug reasons) without implementing custom $ overload? |
18:08:45 | Yardanico | crem, echo it |
18:08:53 | Yardanico | if it's a "ref" object, use this: echo object[] |
18:09:11 | Yardanico | [] gives you object itself from reference |
18:09:18 | FromGitter | <k0pernicus> @dom96 And how do you try a new version? Some troubles with nimblepkg... |
18:09:28 | crem | Indeed, with [] it works! thanks. |
18:09:50 | Yardanico | crem, well there's automatic dereference it experimental features |
18:09:54 | dom96 | k0pernicus: Are you trying to compile choosenim? |
18:10:17 | FromGitter | <k0pernicus> Yep, compile and run |
18:10:56 | dom96 | what error are you getting? |
18:11:27 | FromGitter | <k0pernicus> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ac45cfbc46472974f10ae0] |
18:12:27 | dom96 | nimble c -r choosenim |
18:13:09 | FromGitter | <k0pernicus> Oh ok, I see |
18:13:11 | FromGitter | <k0pernicus> Sorry for that |
18:13:26 | crem | There's no way to access last element of a seq with something like [^-1], is there? ^ is for slices only, right?, x[len(x)-1] is the shortest one to do that? |
18:13:42 | Yardanico | crem, seq[^1] |
18:13:55 | Yardanico | it seems you really didn't use nim for a long time :) |
18:14:06 | Yardanico | it's fine though |
18:15:10 | crem | Indeed! Thanks. Well, I've read all the docs, wrote 100 lines, and then it seemed all clear. And now 1-2 months later I only have vague memory of features and completely forgot the syntax. |
18:15:37 | FromGitter | <abijahm> @ephja thank you inheritance is what i needed |
18:16:46 | FromGitter | <k0pernicus> @dom96 Got an error compiling the project |
18:16:55 | FromGitter | <k0pernicus> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ac4717ba0f0f6e38120b8a] |
18:17:27 | FromGitter | <k0pernicus> And if I try again, the command does not work: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ac4737b16f264642000b27] |
18:19:40 | FromGitter | <k0pernicus> Indeed, not `$HOME/.nimble/pkgs/lib/system.nim` in my filesystem… |
18:26:47 | * | BigEpsilon quit (Ping timeout: 246 seconds) |
18:34:26 | * | BigEpsilon joined #nim |
18:43:09 | dom96 | "428 messages have been suppressed" |
18:43:19 | * | Jesin joined #nim |
18:43:20 | dom96 | wow, never seen that many suppressed |
18:43:57 | FromGitter | <Yardanico> debug build? |
18:44:36 | dom96 | But anyway... https://github.com/nim-lang/nimble#troubleshooting |
18:47:20 | * | qubbler joined #nim |
18:48:19 | qubbler | I read on the nim site that it's garbage collected yet it's a systems lang that's very performant. Is the user mostly in control of memory? Where can I read more on how it works with nim? |
18:50:13 | Yardanico | qubbler, you can read something here https://nim-lang.org/docs/gc.html |
18:50:36 | Yardanico | qubbler, well by default GC pretty much does all memory handling |
18:50:42 | * | yglukhov joined #nim |
18:50:44 | thomasross | i can't find this mentioned anywhere - what is the value of x if i write `var x: int`? is it null/undefined/?? or what? |
18:50:46 | Yardanico | but surely you can use raw pointers and manual memory |
18:50:53 | thomasross | is it like that for all types? |
18:50:53 | Yardanico | thomasross, value types all have default value |
18:50:56 | Yardanico | for int it's 0 |
18:51:02 | thomasross | Yardanico: where can I find the list? |
18:51:02 | Yardanico | float is 0.0 |
18:51:09 | Yardanico | thomasross, list of what? |
18:51:15 | * | BigEpsilon quit (Ping timeout: 252 seconds) |
18:51:15 | thomasross | default values |
18:51:22 | Yardanico | thomasross, well I don't really know |
18:51:25 | Yardanico | but they're really default |
18:51:34 | thomasross | so i'd assume that bool is false? |
18:51:36 | Yardanico | yes |
18:51:40 | thomasross | ok |
18:51:44 | thomasross | thanks |
18:51:47 | Yardanico | and ref types don't have default values |
18:51:51 | Yardanico | because they're references |
18:51:55 | dom96 | thomasross: you know you can test this easily... |
18:51:55 | thomasross | yeah |
18:52:04 | thomasross | dom96: true |
18:52:18 | thomasross | i do think it'd be helpful to write that in the tutorial though |
18:52:39 | * | yglukhov quit (Remote host closed the connection) |
18:52:51 | Yardanico | thomasross, it's in manual |
18:52:55 | Yardanico | https://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement |
18:53:00 | thomasross | oh cool thanks |
18:53:03 | thomasross | forgot to check there |
18:53:18 | Yardanico | The default value depends on the type and is always a zero in binary. |
18:53:23 | Yardanico | so basically in binary it's always 0 :) |
18:54:03 | thomasross | cool |
18:54:03 | crem | Nim documentation is really good. I think it would be nice to have a links to other parts of documentation (index/stdlib/language manual) at the top of every page, or at least a list to a root documentation page. I find that I frequently need to switch between those pages, and there's no way to go from particular page to other pages other than editing URL. Top bar (Blog/Features/Install/Documentation/...) also |
18:54:05 | crem | disappeares on deeper doc pages. |
18:54:16 | Yardanico | crem, search? |
18:54:36 | Yardanico | crem, and yeah, it disappears because documentation is generated separately |
18:54:42 | Yardanico | by "nim doc2" |
18:56:08 | crem | Search is only good when you know what to search. For things like "how to address last element of seq" you actually have to go to a "language manual" and there's no way to go there from for example "nim standard library" page. |
18:56:57 | crem | Anyway, I'm not sure what the problem is, it's just that I found myself editing url too often, which suggests that some important link is missing in content. |
18:57:24 | dom96 | nothing wrong with editing the URL |
18:57:29 | dom96 | I do it all the time |
18:57:40 | Yardanico | well manual and stdlib documentation are different things |
18:57:45 | Yardanico | manual is a real manual |
18:57:52 | Yardanico | which contains language specification |
18:57:53 | * | francisl joined #nim |
18:58:04 | crem | Usually there is a magic way to go to the root of docs. THat would be https://nim-lang.org/docs/ in this case. |
18:58:21 | Yardanico | crem, well this would require to patch auto-generated doc html |
18:59:43 | Yardanico | manual describes the language itself and its' features |
19:02:27 | crem | How can I create an empty object? var x: MyRefObj = new(MyRefObj) # is there anything without typing MyRefObj twice? |
19:02:43 | Yardanico | crem, you don't need to specify object type :) |
19:02:48 | * | xet7 quit (Ping timeout: 240 seconds) |
19:02:48 | Yardanico | var x = new(MyRefObj) |
19:02:54 | Yardanico | maybe you really need to re-read manual? |
19:03:07 | Yardanico | and btw |
19:03:13 | crem | And I don't seem to need new either.. var x = MyRefObj(). |
19:03:15 | Yardanico | you should use new only for ref object |
19:03:16 | Yardanico | yes |
19:03:24 | Yardanico | "new" is used for ref types |
19:03:38 | crem | Byt type MyRefObj = ref object <- ref type |
19:03:54 | Yardanico | crem, well you use "new" in a procedure which returns ref type |
19:03:58 | Yardanico | like new(result) |
19:04:05 | Yardanico | crem, MyRefObj() is a constructor |
19:04:07 | Yardanico | it does that automatically |
19:04:10 | * | xet7 joined #nim |
19:04:40 | crem | I thought nim doesn't have constructors. At least that's a great fame of nim, that it misses constructors. |
19:04:58 | crem | Anyway, I surely spent more than a week reading nim docs, don't want to do that again. :) |
19:05:03 | Yardanico | crem, well they're "object constructors" |
19:05:11 | Yardanico | so you can't overload object constructor |
19:05:23 | Yardanico | instead you create a newObj or initObj procedure |
19:06:13 | Yardanico | crem, about docs: even rust have stdlib and manual separately |
19:06:19 | crem | By the way, does initObj usually return object (seems unlikely), or accepts it as a first paramemter? |
19:06:49 | crem | I don't say they should not be separate! I just say there's nice to have a way to get from one to another. :) |
19:07:09 | dom96 | return |
19:07:20 | Yardanico | I can't find it here https://doc.rust-lang.org/nomicon/README.html :) |
19:07:29 | crem | returns?.. And magically avoids copying them? that's nice. |
19:07:32 | Yardanico | ah |
19:07:34 | Yardanico | wrong link |
19:07:44 | Yardanico | crem, what do you mean by copying? |
19:07:48 | Yardanico | you use |
19:07:58 | Yardanico | var myobj = initMyObj(arguments, for, the, proc) |
19:08:13 | Yardanico | crem, https://doc.rust-lang.org/book/first-edition/ |
19:08:42 | Yardanico | I can't find a way to get to the stdlib docs here :) |
19:09:01 | crem | In C++ if you would return object from a fuction, it would create and copy it! (there's RVO I know, but it's just optimization). |
19:09:26 | Yardanico | crem, I don't know about that |
19:09:38 | Yardanico | ask Araq maybe :) |
19:09:51 | crem | Ok, maybe the problem was that I don't know whether I should go to stdlib or manual for a particular question. :) |
19:09:59 | Yardanico | crem, as I said |
19:10:03 | Yardanico | manual contains info about the language |
19:10:09 | Yardanico | e.g. syntax |
19:10:14 | crem | Like seq and string are core features, and Table is stdlib. |
19:10:31 | Yardanico | well |
19:10:35 | Yardanico | "system.nim" is stdlib too |
19:10:46 | Yardanico | but I don't think it's good to make manual even bigger |
19:11:10 | crem | And also it took ~3 minutes of search to come up with "Table". "map", "dictionary" and "associative array" found nothing for me. :) |
19:11:30 | crem | Anyway, instead of complaining (and I didn't intend to!), I'll try to write some more code. |
19:11:50 | Yardanico | crem, you can also use google |
19:11:57 | Yardanico | "nimlang dict" - first link is https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers |
19:12:00 | ipjk | In the stdlib manual, it has a pharagraph just for collections |
19:12:03 | Yardanico | and there's https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#dictionaries |
19:12:14 | crem | ok, ok :) |
19:15:16 | Yardanico | as I said - a lof of languages don't merge "manual" and "stdlib" too |
19:17:08 | Yardanico | because mostly you don't need to always go for manual |
19:17:24 | Yardanico | you can read it once or twice, and you'll understand the language :) |
19:23:31 | * | MyMind joined #nim |
19:23:35 | crem | I have an object, some of fields of which are refs. What's the easiest way to have them created when I create an object? newObj function explicitly calling new(result.myreffield) for all such fields? |
19:24:19 | Yardanico | crem, result.myfield = @[] |
19:24:22 | Yardanico | for sequence for example :) |
19:24:28 | Yardanico | for string: result.myfield = "" |
19:24:38 | crem | no, it's not sequence, it's my ref object. |
19:25:08 | Yardanico | crem, then you can use object construction :) |
19:25:08 | * | Sembei quit (Ping timeout: 240 seconds) |
19:25:15 | Yardanico | result.myfield = MyObject() |
19:25:32 | * | Pisuke joined #nim |
19:25:50 | crem | But I need newObj() function anyway, right? There's no way to provide some kind of default value on type definition, is there? |
19:26:11 | Yardanico | yes, you should use newObj procedure |
19:26:13 | crem | Hm, then they would share the same object anyway, and that's not what I want.. |
19:26:56 | Yardanico | crem, can you explain more precisely? |
19:26:59 | Yardanico | or give a code snippet? |
19:27:31 | crem | nope, with newObj it's clear.; |
19:27:33 | * | haha_ quit (Quit: haha_) |
19:27:45 | Yardanico | it's idiomatic to use newObj and initObj |
19:28:08 | * | MyMind quit (Ping timeout: 240 seconds) |
19:28:58 | crem | But when object has ref fields, more often than not you want to create all of them, so it feels like some syntax sugar for that would be benefitial. |
19:29:34 | Yardanico | crem, don't create them then? |
19:29:47 | Yardanico | you're not forced to initialise all object fields |
19:31:22 | crem | Yes, but with ref fields I feel forced. :) |
19:31:44 | * | yglukhov joined #nim |
19:31:46 | * | askatasu1 joined #nim |
19:31:58 | Yardanico | crem, well nim will have default values for strings and seqs |
19:32:05 | * | askatasu1 quit (Client Quit) |
19:32:37 | crem | Can we squeeze the same change for other ref objects by any chance? :) |
19:32:47 | Yardanico | crem, I'm afraid not |
19:32:54 | Yardanico | compiler shouldn't be too complicated |
19:34:00 | Yardanico | crem, and you can always ask Araq and he'll explain why there's no some feature in nim |
19:34:32 | Yardanico | or ask on forum |
19:37:38 | crem | why is result.myRefField = MyObj() better than just new(result.myRefFIeld)? Seems to be more typing. |
19:38:39 | Yardanico | crem, who said it's better? |
19:39:15 | crem | Yardanico | result.myfield = MyObject() |
19:39:33 | Yardanico | crem, I didn't said that it's better |
19:39:56 | Yardanico | and you said that new doesn't good for you |
19:40:04 | * | yglukhov quit (Remote host closed the connection) |
19:40:11 | Yardanico | *isn't good |
19:40:31 | Yardanico | if you want to have bigger questions and answers - ask all your question on the forum, it's a common thing |
19:40:57 | crem | I said that I just didn't want to explicitly initialize fields to default (but non nil) values. |
19:41:32 | crem | No, I don't feel I'm ready to ask. I've written 25 lines today and asked gazillion of stupid questions. :) |
19:41:56 | Yardanico | well you can always ask questions like "why ref objects require explicit initialisation?" |
19:51:56 | * | gangstacat quit (Quit: Leaving) |
20:03:22 | Yardanico | guys |
20:03:22 | Yardanico | https://github.com/alehander42/roswell |
20:04:18 | dom96 | cool |
20:04:46 | Yardanico | I'm checking for new Nim repos almost everyday :) |
20:04:51 | Yardanico | e.g. like "language:Nim created:2017-09-03" |
20:05:22 | dom96 | i do that too sometimes |
20:05:29 | dom96 | But I never checked that way |
20:05:40 | dom96 | I always look for recently updated |
20:05:45 | dom96 | with >=0 stargazers |
20:05:56 | dom96 | Sadly Github sometimes fails to give all search results for that |
20:06:06 | Yardanico | yeah |
20:10:37 | * | Yardanico quit (Remote host closed the connection) |
20:19:21 | dom96 | this is a very good way of finding Nim projects |
20:19:42 | dom96 | Another project idea for you: create a Twitter that tweets out new Nim projects :) |
20:20:25 | dom96 | I love how many repos there are containing the examples in my book :) |
20:28:52 | federico3 | I would subscribe to an RSS feed for that |
20:30:58 | dom96 | huh, I wonder if Twitter feeds support RSS |
20:31:04 | federico3 | dom96: http://github-trends.ryotarai.info/ - this shows trendy ones rather than new ones |
20:35:43 | * | relax joined #nim |
20:37:16 | FromGitter | <Bennyelg> Hello |
20:39:18 | FromGitter | <Bennyelg> Create something like that in Nim: ⏎ https://gist.github.com/AlexeySoshin/89b53d9bfd6a70014a00774af8632f55#file-concurrency-in-go-concurrent-map-writes |
20:44:15 | FromGitter | <Yardanico> Use channels and threads ? :) |
20:47:06 | * | SgtLion is now known as SgtSleep |
20:47:33 | FromGitter | <Bennyelg> Heheh, I am trying :| |
20:47:50 | FromGitter | <ephja> 肋 |
20:47:59 | * | PMunch joined #nim |
20:50:09 | * | SgtSleep quit (Quit: Quit: I'm not sure I purposefully hit the quit button.) |
20:51:54 | * | qubbler left #nim (#nim) |
20:53:38 | * | Sentreen quit (Ping timeout: 240 seconds) |
21:03:22 | * | Trustable quit (Remote host closed the connection) |
21:06:44 | * | Sentreen joined #nim |
21:13:03 | * | thomasross quit (Remote host closed the connection) |
21:13:30 | * | thomasross joined #nim |
21:14:10 | * | gokr quit (Ping timeout: 264 seconds) |
21:14:28 | FromGitter | <Bennyelg> random float ? |
21:15:53 | FromGitter | <ephja> yeah sure I'll have 3 |
21:16:18 | FromGitter | <ephja> @Bennyelg https://nim-lang.org/docs/random.html#random,float |
21:17:49 | * | claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com) |
21:18:29 | FromGitter | <Bennyelg> I saw that but There is nothing like: rand.randFloat() which generate anything between 0.0 to 1.0 |
21:18:41 | FromGitter | <Bennyelg> I do not want to pass list into random([0.0, 1.0]) |
21:22:44 | FromGitter | <ephja> is `random(max=1.0)` different |
21:25:09 | FromGitter | <Bennyelg> is not GC-safe as it accesses 'm' which is a globa ⏎ l using GC'ed memory |
21:25:17 | FromGitter | <Bennyelg> function is not GC-safe as it accesses 'm' which is a globa ⏎ l using GC'ed memory .. :/ |
21:25:21 | FromGitter | <ephja> there's also this library https://github.com/oprypin/nim-random |
21:25:29 | FromGitter | <ephja> I see |
21:26:58 | FromGitter | <Bennyelg> I need probably something like guard: lock ? |
21:29:33 | FromGitter | <Bennyelg> https://github.com/nim-lang/Nim/commit/bdf6f59c6d4864d6436f6c517ebab5572d2b937a |
21:37:26 | * | PMunch quit (Quit: leaving) |
21:38:20 | FromGitter | <Bennyelg> I tried but Without success. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ac764cee5c9a4c5f2ce5cc] |
21:40:37 | * | loc8_ quit (Ping timeout: 260 seconds) |
21:44:15 | FromGitter | <Bennyelg> Wait till all is done, but still get much less then expected. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59ac77af162adb6d2e63cb7f] |
21:45:08 | * | loc8 joined #nim |
21:46:01 | * | vlad1777d quit (Remote host closed the connection) |
21:50:25 | * | nsf quit (Quit: WeeChat 1.9) |
21:53:51 | * | relax quit (Ping timeout: 252 seconds) |
22:00:57 | * | vlad1777d joined #nim |
22:01:53 | * | Kingsquee joined #nim |
22:22:02 | * | loc8_ joined #nim |
22:22:21 | * | loc8 quit (Ping timeout: 240 seconds) |
22:25:02 | * | endragor joined #nim |
22:25:16 | thomasross | hmm... when I use mpairs to iterate over a seq I don't get any exception when modifying the seq at the same time but when I use mitems I get an exception. is this a bug or am I doing something wrong? |
22:29:36 | * | endragor quit (Ping timeout: 252 seconds) |
22:37:53 | * | cspar_ quit (Ping timeout: 248 seconds) |
22:42:23 | * | relax joined #nim |
22:47:01 | FromGitter | <adamrezich> is there a way to pass static variables to procs as generic params, like in C++? |
22:47:43 | FromGitter | <adamrezich> (or something equivalent that allows for the same functionality) |
22:50:06 | dom96 | static[T] perhaps? |
22:50:22 | FromGitter | <adamrezich> sorry, I said procs, I meant types |
22:50:45 | dom96 | yeah, same answer |
22:51:31 | FromGitter | <adamrezich> ah, awesome |
22:51:35 | * | relax quit (Ping timeout: 240 seconds) |
22:51:52 | FromGitter | <adamrezich> > ote: static[T] is still in development. ⏎ are there any bugs I need to watch out for or anything like that? |
22:53:57 | dom96 | https://github.com/nim-lang/Nim/labels/Static%5BT%5D |
22:54:07 | dom96 | :) |
23:04:24 | * | def-pri-pub joined #nim |
23:04:40 | * | def-pri-pub quit (Changing host) |
23:04:40 | * | def-pri-pub joined #nim |
23:22:07 | * | ShalokShalom quit (Ping timeout: 260 seconds) |
23:31:49 | * | gangstacat joined #nim |
23:50:23 | * | loc8 joined #nim |
23:53:12 | * | loc8_ quit (Ping timeout: 252 seconds) |