00:01:11 | Araq_ | yeah but i dunno if i patched repr to show this :P |
00:01:17 | * | pregressive joined #nim |
00:01:22 | Araq_ | I planned to do this |
00:06:09 | cheatfate | Araq_, so right now when i'm debugging my macro with `echo(toStrLit(a))` all names i have generated looks like `param` and `param` |
00:06:25 | cheatfate | not so unique |
00:06:30 | cheatfate | as promised :) |
00:06:33 | Araq_ | told ya. |
00:06:46 | Araq_ | you can patch the compiler though |
00:07:34 | cheatfate | ok nm its not very important, one thing which very needed for me - convertation of arguments to NimNode |
00:08:21 | fowl | They are unique |
00:09:07 | fowl | They just have the same name |
00:10:26 | * | yglukhov quit (Remote host closed the connection) |
00:13:56 | cheatfate | fowl, lol they are unique but have same name :) |
00:14:23 | cheatfate | but i understand that strLit() could not handle this and shows not unique names |
00:17:36 | philo | how can I compare a char to the first letter of a string? |
00:22:18 | fowl | the name is the least important aspect of a symbol so |
00:25:12 | * | akaisora joined #nim |
00:27:42 | philo | I can't convert a char to a string, nor vice versa, so how can a compare a char to a letter in a string? |
00:34:30 | * | gokr quit (Ping timeout: 246 seconds) |
00:40:01 | * | Demos joined #nim |
00:49:02 | * | abruanese joined #nim |
00:50:38 | * | Demos_ joined #nim |
00:58:19 | * | Demos_ quit (Ping timeout: 260 seconds) |
01:10:54 | * | yglukhov joined #nim |
01:17:06 | * | francisl quit (Quit: francisl) |
01:17:18 | * | yglukhov quit (Ping timeout: 244 seconds) |
01:39:04 | * | pregressive quit (Remote host closed the connection) |
01:39:36 | * | pregressive joined #nim |
01:43:58 | * | pregressive quit (Ping timeout: 252 seconds) |
01:48:35 | lazypenguin | philo: echo(yourString[0] == 'a') |
01:52:48 | * | chemist69_ quit (Ping timeout: 272 seconds) |
01:54:52 | * | vendethiel joined #nim |
01:59:23 | * | edub4rt quit (Quit: Page closed) |
02:05:52 | * | chemist69_ joined #nim |
02:20:45 | * | freezerburnV quit (Ping timeout: 276 seconds) |
02:27:38 | * | Demos_ joined #nim |
02:38:47 | * | akaisora quit (Read error: Connection reset by peer) |
03:14:34 | * | yglukhov joined #nim |
03:19:03 | * | yglukhov quit (Ping timeout: 240 seconds) |
03:27:48 | * | mahasamoot quit (Ping timeout: 272 seconds) |
03:29:04 | * | philo quit (Ping timeout: 272 seconds) |
03:47:08 | * | lazypenguin quit (Quit: Leaving) |
03:53:20 | * | chemist69_ quit (Ping timeout: 258 seconds) |
03:55:42 | * | chemist69_ joined #nim |
05:16:34 | * | yglukhov joined #nim |
05:21:24 | * | yglukhov quit (Ping timeout: 260 seconds) |
05:23:15 | * | endragor joined #nim |
05:35:55 | * | Demon_Fox joined #nim |
05:38:39 | * | chrisheller quit (Remote host closed the connection) |
05:43:26 | * | chrishel_ joined #nim |
05:51:09 | * | Demos_ quit (Ping timeout: 260 seconds) |
06:25:54 | * | nsf quit (Quit: WeeChat 1.4) |
07:01:01 | * | chemist69_ quit (Ping timeout: 250 seconds) |
07:05:20 | * | chemist69_ joined #nim |
07:09:23 | * | pregressive joined #nim |
07:11:37 | * | pregressive quit (Remote host closed the connection) |
07:18:19 | * | yglukhov joined #nim |
07:23:00 | * | yglukhov quit (Ping timeout: 276 seconds) |
08:20:42 | deavmi | What does ordinal type mean? |
08:31:19 | * | yglukhov joined #nim |
08:31:55 | * | Polynomial joined #nim |
08:36:11 | * | branduardi_ joined #nim |
08:36:26 | * | xet7 quit (Quit: Leaving) |
08:36:34 | * | Polynomial quit (Ping timeout: 250 seconds) |
08:43:59 | * | bjz joined #nim |
08:45:06 | * | bjz_ quit (Ping timeout: 272 seconds) |
08:49:33 | * | euantor joined #nim |
08:49:57 | * | edub4rt joined #nim |
08:51:39 | * | edub4rt quit (Client Quit) |
08:52:49 | * | Matthias247 joined #nim |
08:53:21 | * | euantor quit (Remote host closed the connection) |
08:54:14 | * | edub4rt joined #nim |
08:55:37 | * | edub4rt quit (Client Quit) |
08:57:27 | * | edub4rt joined #nim |
09:00:25 | * | elrood joined #nim |
09:15:48 | * | nsf joined #nim |
09:33:53 | * | euantor joined #nim |
09:33:57 | * | deavmi_mobile quit (Quit: Cheers all. Be good and don't do drugs.) |
09:36:32 | * | euantor quit (Client Quit) |
09:38:13 | * | MyMind joined #nim |
09:39:30 | * | Sembei quit (Ping timeout: 276 seconds) |
09:45:32 | * | gokr joined #nim |
09:51:46 | * | GangstaCat joined #nim |
10:00:57 | * | endragor quit (Ping timeout: 276 seconds) |
10:07:07 | * | miqlas-H joined #nim |
10:07:11 | miqlas-H | Hi Guys! |
10:07:37 | miqlas-H | Here is my patch to extending the Haiku support: http://termbin.com/g7w1 |
10:08:55 | dom96 | miqlas-H: Can you submit it as a PR on http://github.com/nim-lang/Nim? |
10:13:29 | cheatfate | i want to use macro in such way `await mymacro(..)`, and my macro generates some preparation code before it call to proc |
10:13:48 | cheatfate | how i can finish my macro? |
10:14:07 | cheatfate | or i need to make await someproc(..) in macro? |
10:15:33 | miqlas-H | dom96: i think, but not right now |
10:15:58 | dom96 | cheatfate: what are you up to? |
10:17:03 | cheatfate | dom96, i'm making macro which accepting `varargs[typed]` it generates some preparation code and make call to someProc() |
10:17:30 | cheatfate | it must be someProc() returns Future |
10:17:43 | dom96 | cheatfate: hrm, what's the use case for this macro? |
10:17:52 | cheatfate | dom96, performing sql query |
10:18:06 | dom96 | cool |
10:18:11 | cheatfate | postgres sql query |
10:18:41 | cheatfate | which can accept parameters of this query in arrays, but this parameters must be converted so i need some preparation code |
10:19:07 | cheatfate | and after that i need to call my proc execAsync() which returns Future |
10:19:43 | cheatfate | so i'm looking a proper way to do it, so for application it will be call like await mymacroName(sqlstatement, varargs[typed]) |
10:19:46 | dom96 | for 'await myMacro(...)' I think you will need to generate: 'await (command; command2; myFuture)'. You can check what the AST for that looks like by using 'dumpTree'. |
10:21:47 | miqlas-H | Bye! |
10:21:58 | cheatfate | dom96, so if there like 100 commands in preparation i need to return `await (command0; ...; command99; myFuture)? |
10:22:16 | * | miqlas-H quit (Quit: Vision[0.9.7-H-20140108]: i've been blurred!) |
10:22:46 | dom96 | cheatfate: I think so yeah |
10:23:09 | cheatfate | Araq_, ping? |
10:23:14 | cheatfate | i know you are alive :) |
10:29:58 | cheatfate | dom96, but it looks like tuple, is it ok? |
10:30:29 | dom96 | cheatfate: what looks like a tuple? |
10:30:39 | cheatfate | 'await (command; command2; myFuture)' |
10:30:58 | cheatfate | is `;` magic symbol which allows to put command in one line? |
10:31:01 | dom96 | It's not a tuple. It's a expression list. |
10:31:03 | dom96 | Yes. |
10:38:30 | cheatfate | dom96, for some reason i can't generate this expression list |
10:39:24 | cheatfate | dom96, https://gist.github.com/cheatfate/f21c0e24927500ebc5a0502d2246a75d this returns error |
10:41:25 | dom96 | This works https://gist.github.com/dom96/167c0fb152f595542ad6bff32512c80c |
10:41:31 | dom96 | But adding 'await' in front of it fails :\ |
10:44:45 | * | bjz quit (Max SendQ exceeded) |
10:45:51 | * | bjz joined #nim |
10:47:20 | * | gokr quit (Ping timeout: 272 seconds) |
10:48:26 | cheatfate | dom96, looks like StmtListExpr a little bit undocumented ... :P |
10:48:35 | cheatfate | i can't find nnk for it |
10:55:02 | cheatfate | ouch, nm i have found it |
10:57:04 | * | mostworst joined #nim |
11:16:45 | * | branduardi_ quit (Quit: Leaving) |
11:17:14 | * | hendi joined #nim |
11:17:51 | * | GangstaCat quit (Ping timeout: 264 seconds) |
11:27:07 | * | brson joined #nim |
11:27:36 | * | Matthias247 quit (Read error: Connection reset by peer) |
11:32:11 | * | yglukhov quit (Remote host closed the connection) |
11:47:21 | * | Eddy_ joined #nim |
11:51:45 | * | mostworst quit (Ping timeout: 244 seconds) |
11:55:15 | * | sdw quit (Ping timeout: 260 seconds) |
11:57:42 | * | desophos quit (Read error: Connection reset by peer) |
12:01:13 | * | Eddy_ left #nim (#nim) |
12:19:20 | * | mostworst joined #nim |
12:37:41 | * | nsf quit (Quit: WeeChat 1.4) |
12:49:18 | * | hendi quit (Ping timeout: 276 seconds) |
12:58:58 | * | brson quit (Quit: leaving) |
13:11:48 | * | elrood quit (Quit: Leaving) |
13:13:19 | * | chemist69_ quit (Ping timeout: 260 seconds) |
13:15:38 | * | chemist69_ joined #nim |
13:34:45 | kier | how should I be organising source files in my nimble package? |
13:35:47 | kier | before v0.14.0 (or whatever the coincident Nimble version was) I had source files in a directory 'pkg/' under my repository root, and files imported each other as 'pkg.file' |
13:36:02 | kier | but that setup doesn't seem to work anymore since the update |
13:37:35 | def- | you can probably work around that with a nim.cfg containing path = "$projectPath" (or something like that) |
13:38:10 | * | mostworst quit (Ping timeout: 244 seconds) |
13:39:25 | kier | how should I ideally be doing it? |
13:39:57 | def- | internally you could just import with 'file' instead of 'pkg.file'. from other modules it should be available as 'pkg.file' |
13:41:36 | kier | ah i see. imports within the same package are relative now? |
13:43:11 | def- | I'd guess it's one of the mentions of "relative" in 0.14: http://nim-lang.org/news/2016_06_07_version_0_14_0_released.html |
13:46:59 | kier | yep, it's in there (but doesn't mention the word "relative", try "path handling" instead). |
13:47:07 | kier | probably should have read that at some point before now |
13:54:41 | kier | huh, tables.clear() is broken. can't believe I didn't spot that earlier |
14:00:22 | kier | or am I just incompetent... |
14:00:55 | * | akaisora_ joined #nim |
14:08:07 | * | PMunch joined #nim |
14:09:39 | * | Trustable joined #nim |
14:15:41 | * | gokr joined #nim |
14:20:22 | * | Matthias247 joined #nim |
14:25:39 | vktec | How do I delete an entry (or reset it to 0) in a CountTable? |
14:31:30 | kier | table[key] = 0 ? |
14:32:37 | kier | functionally works, but it looks like the key still stays in the table |
14:32:54 | * | sdw joined #nim |
14:33:13 | kier | doesn't look like there's a del proc for counttables |
14:33:30 | vktec | Nope, it doesn't work |
14:33:39 | vktec | I tried that already |
14:34:09 | kier | it doesn't compile, or doesn't change the value? |
14:34:17 | kier | either way that's probably an issue |
14:34:21 | vktec | 0 < val [AssertionError] |
14:34:25 | vktec | (runtime error) |
14:34:54 | vktec | It's checking to see if it's negative, but doing it wrong |
14:35:08 | vktec | It should be `not val < 0` |
14:35:18 | vktec | No, wait |
14:35:23 | vktec | `val > 0` |
14:35:29 | vktec | `val >= 0` |
14:35:30 | kier | val >= 0 would work |
14:35:31 | vktec | Sorry |
14:35:54 | vktec | kier: Yes, it's a bug in the code, AFAIK |
14:35:57 | vktec | *AFAICT |
14:36:10 | vktec | I wanted to make sure I wasn't missing something |
14:36:14 | kier | possibly the combination of that and the fact that there's no 'del' method implies that there's some reason that removing entries from the table isn't implemented |
14:36:32 | kier | but its more likely that its just a typo and that use case just hasn't been encountered yet |
14:37:01 | kier | make an issue on github about it |
14:37:15 | renesac | or make a pull request directly |
14:37:20 | kier | or that |
14:37:40 | vktec | Okay, will do |
14:38:01 | renesac | examples of usage for countTable in the documentation are also appreciated |
14:38:16 | vktec | Okay |
14:38:20 | kier | interestingly, there's no assertion like that on CountTable.inc, so table.inc(key, -table[key]) is potentially a valid solution |
14:38:47 | vktec | Ooh, thanks, I'll use that as a workaround for now |
14:51:52 | vktec | Okay, I've created an issue (it's a very minor change, so probably easier for a contributor):https://github.com/nim-lang/Nim/issues/4366 |
14:53:40 | * | Trustable quit (Remote host closed the connection) |
15:18:47 | vktec | Does `nim c -d:release` imply `nim c --opt:speed`? |
15:18:59 | vktec | Can I combine the two? |
15:21:20 | vktec | Also, is running binaries compiled on one Linux distro on another distro a sensible idea? |
15:21:53 | vktec | If not, can I get the C sources for my program and compile on the target machine? |
15:22:06 | vktec | Sorry for the barrage of questions |
15:23:18 | cheatfate | vktec, it depends on cpu architecture and bitness |
15:23:30 | cheatfate | also it depends on libraries you using |
15:23:32 | vktec | Same architecture |
15:23:54 | vktec | Probably not a good idea then, Arch vs Debian stable :D |
15:24:17 | cheatfate | if architecture is same and executable linked statically it will works, but if it linked dinamically problems can be |
15:24:32 | vktec | Can I tell Nim to statically link it? |
15:24:47 | vktec | Or check whether it's statically or dynamically linked? |
15:32:34 | gokr | vktec: You can check my article on ardunimo - I produce C files and compile them manually using a Makefile there. |
15:32:57 | gokr | http://goran.krampe.se/2016/02/25/nim-meets-arduino/ |
15:33:18 | * | hendi joined #nim |
15:33:22 | vktec | Thanks, I'll take a look |
15:34:11 | * | xet7_ joined #nim |
15:36:00 | cheatfate | dom96, its not a good idea to `if a.tzname == "UTC"` its better to check `if a.timezone == 0` |
15:48:57 | * | Matthias247 quit (Read error: Connection reset by peer) |
16:01:05 | * | JackIsJack joined #nim |
16:08:28 | * | NimianAsAlways joined #nim |
16:12:26 | * | JackIsJack quit (Ping timeout: 250 seconds) |
16:13:57 | * | xet7_ quit (Ping timeout: 250 seconds) |
16:15:43 | sdw | is the nim website on github? nim-atom is missing from the editor list on the faq page |
16:16:06 | sdw | I don't know what would be the best way to submit a PR |
16:16:10 | * | filcuc joined #nim |
16:16:48 | dom96 | sdw: https://github.com/nim-lang/Nim/blob/devel/web/question.rst |
16:17:25 | sdw | thanks |
16:19:48 | * | NimianAsAlways quit (Ping timeout: 250 seconds) |
16:21:15 | dom96 | cheatfate: 'a.timezone' seems to always be 0. |
16:21:25 | dom96 | perhaps that's a different bug |
16:22:24 | * | deavmi quit (Ping timeout: 250 seconds) |
16:27:24 | * | ephja joined #nim |
16:35:52 | * | kingofoz quit (Ping timeout: 264 seconds) |
16:36:10 | onionhammer | are bounds checks still disabled in -d:release? |
16:37:03 | * | kingofoz joined #nim |
16:38:38 | dom96 | onionhammer: looks like it: https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L54 |
16:40:06 | onionhammer | hmm |
16:40:19 | onionhammer | seems like a lot of those shouldnt be disabled |
16:46:45 | * | kingofoz quit (Ping timeout: 244 seconds) |
16:47:08 | * | kingofoz joined #nim |
16:49:10 | def- | onionhammer: well, they cost you performance |
16:50:15 | def- | onionhammer: I benchmarked all of them once and the thing is in micro-benchmarks gcc compiles them away, but in realistic programs they have an impact |
17:21:54 | * | chemist69_ quit (Ping timeout: 272 seconds) |
17:25:56 | * | chemist69_ joined #nim |
17:40:11 | * | elrood joined #nim |
17:43:17 | * | xet7_ joined #nim |
17:52:10 | * | nsf joined #nim |
18:02:20 | * | Fribby joined #nim |
18:06:18 | * | philo joined #nim |
18:06:25 | * | mahasamoot joined #nim |
18:07:17 | * | mostworst joined #nim |
18:11:20 | vktec | Anyone here develop websites/webapps with Nim? |
18:11:55 | vktec | I'm trying to figure out the best way to deploy them... |
18:14:42 | * | deavmi_mobile joined #nim |
18:25:07 | * | mcc joined #nim |
18:28:56 | Araq_ | vktec: behind a proxy that's been battle tested for security |
18:29:11 | vktec | :) |
18:29:31 | vktec | I was more wondering about how to handle compiling |
18:29:52 | vktec | ie. compile fully on server, compile to c locally then to binary on server or compile fully locally |
18:35:00 | * | yglukhov joined #nim |
18:37:41 | * | yglukhov quit (Remote host closed the connection) |
18:39:44 | Araq_ | compile on server. |
18:40:02 | edub4rt | I was trying to use tcmalloc/jemalloc with nim (by statically linking it) but found out that it didn't work, is it possible to use them instead of Nim's default allocator without disable the GC? |
18:41:04 | vktec | Araq_: Yeah, that's what I've decided |
18:43:16 | edub4rt | I saw that nim does have a lot of options for GC, but found no options for other memory allocators, nor disabling it without disabling the GC, that mades me think how performant is the nim's memory allocators compared to others one like tcmalloc? |
18:44:18 | Araq_ | edub4rt: no it's not possible nor do jemalloc anything that would be beneficial for Nim, IMO. |
18:45:07 | Araq_ | these malloc replacements try to serve allocation requests as fast as possible to different threads (shared heap), but Nim doesn't even require a shared heap |
18:45:30 | Araq_ | so you trade lockfree cas instructions against no cas instructions nor locks at all. |
18:47:36 | edub4rt | benchmarking the asynchttpdispatcher, the most used function is rawAlloc, which is a nim's allocator routine, I wanted to just throw away nim's memory allocator and use malloc/free instead then link the tcmalloc to see if would have performance gains, but I see that this is not possible, the GC is completely dependent on current allocator implementation |
18:48:22 | edub4rt | I do not know much about allocators internals, but I see no reason to allocator wasting much time allocating many small objects (that's whats is happening) |
18:49:36 | Araq_ | before I wrote Nim's allocator I used dlmalloc |
18:49:57 | Araq_ | mine allocator was faster :P |
18:50:00 | Araq_ | *my |
18:52:17 | edub4rt | that depends on the application, and IMO tcmalloc/jemalloc is much better than dmalloc |
18:52:31 | edub4rt | dlmalloc* |
18:53:15 | Araq_ | yeah but iirc jemalloc uses Nim's algorithms anyway, they all pretty much converged to what Nim does |
18:55:08 | Araq_ | that doesn't mean Nim's alloctor cannot be further optimized, but it's really not bad. |
18:56:07 | edub4rt | then I will assume that it is fast as jemalloc for now, I just don't feel confident because I can't really test, but would be nice if the allocator had more abstraction, so we could switch and test other allocators, like we do with the GC |
19:00:08 | Araq_ | which allocator supports isInteriorPointer in O(1) ? |
19:00:42 | Araq_ | none of these. you cannot abstract away this critical feature requirement. |
19:01:45 | edub4rt | yep, I was trying to hack somehow to use malloc/free instead, but that function was the barrier, the GC would have to somehow be changed to function without it |
19:02:23 | edub4rt | does some kind of objectpool allocator class exists in nim? so I could use it instead of reallying in the GC and its memory allocator? |
19:05:09 | edub4rt | relying* |
19:05:25 | edub4rt | for what I'm doing an object pool would perform much better, and might be useful for others who doesn't want to use the GC too for a critical part |
19:07:36 | Araq_ | well Nim advocates newObj instead of new(obj) so that you can make newObj use a pool |
19:07:53 | * | deavmi joined #nim |
19:08:10 | Araq_ | I argued yesterday that it's a pretty bad idea, but *shrug* test it. |
19:09:03 | PMunch | Hmm, is there/what is the correct way to do something like a malloc to copy part of an array into another in Nim? |
19:15:37 | * | lazypenguin joined #nim |
19:16:25 | * | PMunch quit (Quit: leaving) |
19:19:09 | * | filcuc quit (Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/) |
19:27:31 | * | deavmi_mobile quit (Quit: Cheers all. Be good and don't do drugs.) |
19:29:05 | * | deavmi_mobile joined #nim |
19:44:11 | * | yglukhov joined #nim |
19:50:57 | cheatfate | Araq_, i have a small problem with macro :) |
19:52:33 | cheatfate | is it possible to make `await myMacro(..., varargs[typed])` and in macros i want to make some preparation and call {.async.} function |
19:59:50 | Araq_ | no idea what you mean |
20:02:04 | dom96 | he wants `await myMacro(...)` to expand like so: `await (command1; command2; newFuture())` |
20:05:38 | philo | does anyone here do gui? If so which tk do you use? |
20:06:15 | Araq_ | philo: libui |
20:06:31 | dom96 | gtk |
20:06:38 | dom96 | Araq_: Don't lie, you use SDL2. |
20:06:59 | philo | never heard of libui. |
20:07:09 | Araq_ | dom96: ok ok, I lied. but libui is what I currently like best. |
20:07:28 | philo | Araq_, why is that? |
20:07:33 | cheatfate | dom96, problem that code is not working... |
20:13:02 | * | desophos joined #nim |
20:19:41 | * | Demon_Fox quit (Quit: Leaving) |
20:22:28 | cheatfate | Araq, i have function which makes query to postgres in async way using arrays which describes parameters to sql |
20:22:43 | cheatfate | i have macro which takes varargs[typed] and convert it to arrays |
20:23:21 | cheatfate | i want to call this function from macro |
20:23:50 | cheatfate | and my macro usage must be like 'await myMacro(..., varargs[typed]) |
20:24:53 | edub4rt | small question, I have an object "b" inside another object "a", I normally I use a.b.method() to call a method from b, but I would like to create a shortcut like "let b = a.b" then use "b.method" (so I don't have to type "a."), but let/var will clearly not work here, as var would copy, and let would not allow to modify, so what I need is to capture b by reference, what is the proper way to do that? |
20:26:31 | * | mostworst quit (Ping timeout: 252 seconds) |
20:31:04 | * | mostworst joined #nim |
20:32:33 | mcc | is b an object or a ref object? |
20:34:32 | edub4rt | an object |
20:35:13 | edub4rt | B = object ... |
20:38:44 | mcc | hm, i am not sure this is a thing nim allows. i know you can get a ptr with addr a.b but that might have effects you don't want... |
20:42:04 | Araq_ | edub4rt: var b = addr(a.b) |
20:42:14 | Araq_ | there is no other way |
20:46:33 | gokr | Is it moving along? It looked darn neat |
20:46:45 | gokr | (oops, I am behind - libui I mean) |
20:46:53 | ephja | what up |
20:48:31 | gokr | edub4rt: Generally of course that's "bad OO" - doing a.b.xxx |
20:49:46 | * | deavmi quit (Ping timeout: 250 seconds) |
20:51:01 | edub4rt | that's why I would like a shortcut, and I do not want to store as a ref object because would cause more allocations |
20:52:14 | gokr | But you wold be doing the same thing - just with less characters. |
20:52:43 | gokr | The problem is that the code outside of a will be hardcoded to depend on a having a b. |
20:52:58 | gokr | But I may be misunderstanding of course. |
20:54:18 | edub4rt | it is dependent in my code |
20:55:10 | edub4rt | tried "var b = addr(a.b)[]" but that failed |
20:55:59 | edub4rt | in C is common to do this doing B& b = a.b |
20:56:21 | edub4rt | anyway I can live with that |
20:58:54 | edub4rt | "var b = addr(a.b)[]" must is copying to, capturing by reference without using pointers is clearly not possible in nim, maybe because can be considered dangerous, could have a keyword for that, but nvm |
21:04:06 | * | deavmi_mobile quit (Quit: Cheers all. Be good and don't do drugs.) |
21:05:12 | * | deavmi_mobile joined #nim |
21:06:25 | fowl | In c++ you mean? anyway a reference there is just a hidden pointer |
21:08:11 | edub4rt | yep C++*, I know |
21:09:59 | edub4rt | other question, is it possible possible to create a C library using nim? to use in my C/C++ code? |
21:10:13 | vktec | edub4rt: Yes, it has been done |
21:10:27 | vktec | I can't remember the link, but there was a blog post |
21:11:02 | * | Heartmen- quit (Remote host closed the connection) |
21:13:12 | * | Heartmender joined #nim |
21:13:35 | * | Heartmender is now known as Guest2750 |
21:14:10 | gokr | Araq_: Cool (ui) |
21:15:22 | edub4rt | nim would have to generate a C header, export functions, I guess that is not available by default and would need some hacking? |
21:20:56 | Araq_ | edub4rt: Nim can generate a header for you |
21:21:18 | edub4rt | how? |
21:21:32 | Araq_ | --header or --genHeader, can't remember |
21:22:44 | mcc | edub4t: the way i think about the "can't get ref to a.b" thing is that non-ref objects in nim aren't really very object-like.. they're values... some of the object-oriented behaviors you're used to want refs to work |
21:23:27 | * | mostworst quit (Ping timeout: 276 seconds) |
21:25:10 | edub4rt | Araq_: it does generate a header, but with just 3 functions, none of mine, is there a pragma to mark which functions should be defined in the header? |
21:25:29 | Araq_ | yes, .exportc them |
21:26:47 | edub4rt | Araq_: okay now it appears, but the name is unreadable (has types and numbers), how to give a proper name? |
21:27:29 | Araq_ | .exportc: "namehere" |
21:27:29 | edub4rt | my bad, aw the struct name is unreadable, the function name is ok, but still would need a prefix |
21:27:43 | Araq_ | .exportc: "prefix$1" |
21:32:16 | * | chemist69_ quit (Ping timeout: 264 seconds) |
21:32:27 | * | gokr quit (Ping timeout: 250 seconds) |
21:32:35 | * | Guest2750 quit (Remote host closed the connection) |
21:33:34 | * | Heartmen- joined #nim |
21:36:08 | * | chemist69_ joined #nim |
21:36:39 | edub4rt | cool, so I can code a library in nim, compile to C, and use in my other C/C++ projects |
21:37:54 | * | Heartmen- quit (Client Quit) |
21:38:55 | * | Heartmen- joined #nim |
21:39:18 | * | nimnoob123 joined #nim |
21:43:08 | * | nimnoob123 quit (Client Quit) |
21:46:34 | * | Heartmen- quit (Quit: EliteBNC free bnc service - http://elitebnc.org - be a part of the Elite!) |
21:46:35 | edub4rt | does anyone know or have experience in using nim in production for any kind of server? if so, does your server app leak/crashes often or is it really solid stable? |
21:46:46 | * | Heartmen- joined #nim |
21:51:47 | * | Heartmen- quit (Quit: EliteBNC free bnc service - http://elitebnc.org - be a part of the Elite!) |
21:53:06 | * | elrood quit (Quit: Leaving) |
21:55:54 | * | Heartmen- joined #nim |
21:56:33 | edub4rt | I have tested nim's performance, portability, capability, APIs, now my only concern is stability for a server and debugging, but I guess debugging is easy considering there is tracing and debugging with gdb is possible, so my last concern is stability |
21:56:45 | dom96 | edub4rt: The forum is written in Nim and seems to be running pretty solidly. |
21:57:03 | dom96 | Although we do automatically restart it if it crashes. |
21:57:57 | edub4rt | dom96: does it leak? if you run for example, without restart, for 7 days, the mem will grow? |
21:58:42 | edub4rt | when it crashes, why it does? your app's fault? or nim's core fault? |
21:58:51 | Araq_ | edub4rt: it used to do exactly that but with 0.14 these issues are gone, afaik |
21:59:31 | dom96 | Indeed. It used to leak but now doesn't anymore. |
21:59:47 | dom96 | Although I really need to add some uptime information into it |
21:59:53 | dom96 | I'm not really sure what it's current uptime is |
22:00:10 | dom96 | *its |
22:00:13 | * | Heartmen- quit (Remote host closed the connection) |
22:01:08 | dom96 | But NimBot is also written in Nim and it's running very solidly. |
22:01:11 | dom96 | !lag |
22:01:11 | NimBot | 88ms between me and the server. |
22:01:19 | dom96 | I really need to add more commands |
22:01:40 | Araq_ | !ping |
22:01:40 | NimBot | pong |
22:01:42 | edub4rt | in a crash scenario for the nim's forum, do you find the root cause of the problem with ease? |
22:02:11 | * | euantor joined #nim |
22:02:14 | edub4rt | if so how? looking into the core dump with gdb? traceback? |
22:02:33 | Araq_ | edub4rt: come on, never seen one of Nim's NICE tracebacks? |
22:02:49 | edub4rt | nope, I didn't test that yet |
22:02:59 | dom96 | Indeed, the forum is running in debug mode so we get nice tracebacks in the logs. |
22:03:02 | Araq_ | and you can combine -d:release with --strackTrace:on even though not many know about it |
22:03:03 | edub4rt | I didn't coded a crash yet |
22:03:22 | * | Heartmender joined #nim |
22:03:30 | Araq_ | but yeah, better GDB support is being worked on too |
22:03:44 | * | Heartmender is now known as Guest52203 |
22:04:59 | * | euantor quit (Remote host closed the connection) |
22:05:09 | * | ephja quit (Quit: WeeChat 1.5) |
22:06:01 | dom96 | I just checked the logs and I don't actually see any crashes. |
22:06:22 | edub4rt | for how long? |
22:07:05 | edub4rt | how can I can fool the nim compiler to crash so I can see a backtrace? |
22:07:43 | dom96 | raise newException(Exception, "FOObar") in a proc |
22:07:53 | * | Guest52203 quit (Remote host closed the connection) |
22:08:29 | edub4rt | not just an exception an actual C crash |
22:10:34 | edub4rt | a SIGSEGV |
22:11:23 | * | Heartmen- joined #nim |
22:11:24 | * | freezerburnV joined #nim |
22:12:36 | renesac | edub4rt: search in the bugtrackers for the tag crash |
22:12:44 | renesac | *bugtracker |
22:13:06 | edub4rt | haha, good idea |
22:13:21 | mcc | type whatever = ref object\nx:int; var y:whatever; y.x = 0 |
22:15:09 | * | ddl_smurf joined #nim |
22:15:20 | Araq_ | ddl_smurf is back! wooohooo. |
22:15:54 | ddl_smurf | Hiya =) Congrats on the continued dev |
22:16:10 | * | Heartmen- quit (Remote host closed the connection) |
22:16:17 | * | kulelu88 joined #nim |
22:16:23 | Araq_ | thanks |
22:16:24 | * | akaisora_ quit (Ping timeout: 260 seconds) |
22:16:32 | edub4rt | mcc: thanks worked |
22:16:49 | edub4rt | sigsegv does print a nice traceback too, using gdb the traceback is also readable |
22:16:58 | * | Jesin quit (Quit: Leaving) |
22:18:39 | dom96 | hello ddl_smurf! |
22:20:13 | ddl_smurf | hi dom96 =) |
22:27:48 | dom96 | ddl_smurf: what brings you back to #nim? :) |
22:28:51 | * | freezerburnV quit (Ping timeout: 240 seconds) |
22:29:09 | * | yglukhov quit (Remote host closed the connection) |
22:30:20 | Araq_ | boredom :P |
22:30:44 | ddl_smurf | irc =) it means i'm in trouble =) have a misbehaving esp8266 |
22:31:01 | ddl_smurf | irc is had to follow man |
22:41:47 | * | hendi quit (Ping timeout: 250 seconds) |
22:44:55 | * | freezerburnV joined #nim |
22:48:13 | cheatfate | dom96, why i need newFuture() at the end? |
22:48:28 | dom96 | cheatfate: you don't, it was just an example |
22:49:05 | cheatfate | but last statement in list must be call to async functions? |
22:51:41 | * | Heartmen- joined #nim |
22:54:14 | cheatfate | i made it but got an error... |
22:54:29 | cheatfate | Error: value of type 'Future[system.void]' has to be discarded |
22:54:45 | cheatfate | but there no Future[system.void] at all |
22:59:34 | * | Heartmen- quit (Remote host closed the connection) |
23:10:26 | * | deavmi_mobile quit (Read error: Connection reset by peer) |
23:12:28 | * | Heartmender joined #nim |
23:12:49 | * | Heartmender is now known as Guest22271 |
23:16:04 | edub4rt | a is a string, "let b = a.substr(1,10)" does b points to a slice of "a" data or nim allocates a completely new string? |
23:16:49 | * | Guest22271 quit (Remote host closed the connection) |
23:18:06 | edub4rt | from what I understood in the code, nim does allocate a new one |
23:19:05 | Araq_ | yes, that's also what Python does fwiw. |
23:19:06 | edub4rt | but that's unoptimized, b uses a "let" statement, so there would be no need to allocate a new string |
23:19:41 | Araq_ | sure there would unless you swap out completely Nim's internal representation of strings |
23:20:13 | def- | edub4rt: and what if you modify a later? |
23:20:15 | edub4rt | I just found out that slices of arrays does this too, woah, the slice allocates a new seq |
23:21:04 | edub4rt | this changes completely how I was working and thinking, I will have to work with pointers to avoid extra allocations in those cases? |
23:21:41 | Araq_ | no, you only need a decent Slice datatype |
23:21:49 | Araq_ | which the stdlib lacks |
23:21:51 | * | arnetheduck joined #nim |
23:22:33 | * | Heartmen- joined #nim |
23:23:04 | edub4rt | Araq_: what python does has nothing to do with nim right? nim is completely other thing and I don't like python, so slow |
23:24:44 | edub4rt | now I'm imagining extra allocations everywhere inside nim's internals |
23:26:34 | edub4rt | I don't get why there are let/var keywords if those optimizations are not made, I thought it was for performance reasons, but now I am thinking it's just for safety? |
23:26:51 | * | Heartmen- quit (Remote host closed the connection) |
23:29:30 | Araq_ | it's easier to reply and explain things when people don't already know everything |
23:30:28 | * | heretobang joined #nim |
23:30:29 | Araq_ | in Nim a string is struct { length, cap, data } |
23:30:57 | Araq_ | how can you create a substring from 1 without a copy in this setup? you cannot. |
23:31:58 | Araq_ | aha! you say, "see? this is all wrong, it should have been {length; char* data; } from the beginning!" |
23:32:36 | Araq_ | so now every string you pass around is 2 machine words, not 1 and the ownership is unclear (can you append to a slice? if so, what is affected?) |
23:33:00 | Araq_ | and the GC needs to deal with interior pointers which are harder to support |
23:33:26 | Araq_ | fine, you say, keep a pointer to the beginning so that the GC can continue to be a RC'ing GC ... |
23:33:53 | Araq_ | so the representation is { length; char* data; char* orig; } |
23:34:11 | * | fvs joined #nim |
23:34:47 | Araq_ | now it's 3 words you pass around all the time and it's not that clear it's really so wise to pretend slicing is super cheap when it isn't |
23:35:54 | edub4rt | I see your point |
23:36:50 | renesac | open array is a lenght and pointer duo? |
23:36:53 | renesac | or only a pointer? |
23:37:13 | renesac | I know it is for parameters only |
23:37:23 | Araq_ | renesac: a duo |
23:37:37 | renesac | for pointing at things on the satck? |
23:37:41 | renesac | *stack |
23:38:39 | * | arnetheduck quit (Ping timeout: 276 seconds) |
23:40:31 | * | chemist69_ quit (Ping timeout: 258 seconds) |
23:41:46 | * | arnetheduck joined #nim |
23:42:57 | * | chemist69_ joined #nim |
23:43:40 | Araq_ | renesac: yes but it can point to anything |
23:44:41 | * | GangstaCat joined #nim |
23:45:22 | * | renesac_ joined #nim |
23:45:53 | * | Heartmen- joined #nim |
23:47:06 | renesac_ | right |
23:47:29 | Araq_ | edub4rt: I see more value in stealing C++'s "small string optimization" where the payload is directly embedded in the struct and x[1..3] copies, but doesn't allocate |
23:48:05 | * | renesac quit (Ping timeout: 260 seconds) |
23:48:06 | edub4rt | I still miss something to pass a slice of a buffer to another proc without duplicating, I don't want to use pointers/length but that now I see that as my only option, because the buffer is huge, and I want just to pass a slice of it for doing checksum |
23:48:22 | * | Demos_ joined #nim |
23:49:03 | * | arnetheduck quit (Ping timeout: 240 seconds) |
23:49:26 | Araq_ | edub4rt: I usually pass array, start to the proc then |
23:49:56 | edub4rt | Araq_: okay for smalls strings I agree, either SSO or COW I'm fine, but in my case are huge buffers, and I am not even using string class, I just noticed that for strings, I can live with that |
23:51:07 | * | Heartmen- quit (Remote host closed the connection) |
23:52:09 | * | Heartmen- joined #nim |
23:52:10 | edub4rt | simple enough, I was using slices because thought it was cleaner and the right way in Nim, but found this, okay will do this other way |
23:55:07 | * | Sentreen joined #nim |
23:55:25 | * | arnetheduck joined #nim |
23:56:45 | * | Heartmen- quit (Remote host closed the connection) |