00:07:12 | FromGitter | <gogolxdong> bindSym |
00:12:38 | * | demtomohiro quit (Quit: Leaving) |
00:13:19 | FromGitter | <arnetheduck> so looks like my particular gcc causes markandsweep to go nuts at -O3 level.. -O2, -Os all work fast, as does -flto.. weird |
00:16:58 | FromGitter | <rayman22201> @zacharycarter https://gist.github.com/rayman22201/77e6360a7508e2fcba08487c366b1737 |
00:26:46 | * | francisl joined #nim |
00:34:15 | AlexMax | Wait a minute, what's this |
00:34:30 | AlexMax | Does c2nim know how to deal with functions like `nk__draw_begin` |
00:36:38 | AlexMax | Inside the output nim file, I see an importC to 'nk_draw_begin' |
00:36:54 | AlexMax | Problem is, the actual function name is nk__draw_begin |
00:37:00 | AlexMax | Wonder if that's nimgen or c2nim |
00:38:27 | * | abm joined #nim |
00:38:34 | AlexMax | also lol - "while true:" complains about an ambiguous identifier, and I can't disambiguate it |
00:47:33 | * | heinrich5991 quit (Ping timeout: 245 seconds) |
00:47:34 | * | flyx quit (Ping timeout: 240 seconds) |
00:48:31 | * | abm quit (Read error: Connection reset by peer) |
00:49:20 | AlexMax | the compiler suggests bool.true, but that gives me a different error about a missing field |
00:49:27 | AlexMax | maybe the compiler message is out of date |
00:49:47 | * | heinrich5991 joined #nim |
00:51:11 | * | flyx joined #nim |
00:53:37 | * | heinrich5991 quit (Client Quit) |
01:40:17 | * | heinrich5991 joined #nim |
01:43:47 | shashlick | That might be nimgen |
01:43:57 | shashlick | Cause I replace __ with _ |
01:44:03 | shashlick | Since Nim didn't like that |
01:44:33 | shashlick | But should be okay in an importc |
01:45:45 | * | heinrich5991 quit (Quit: quit.) |
01:49:26 | * | Rame21 joined #nim |
01:50:07 | * | Rame21 quit (Remote host closed the connection) |
01:55:06 | AlexMax | shashlick: 10-4, I'll let you know if it crashes |
01:57:11 | AlexMax | I'm nearly done with the header that deals with setting up GL state |
02:03:54 | * | francisl quit (Quit: francisl) |
02:10:47 | * | zachcarter joined #nim |
02:13:51 | * | leorize quit (Quit: WeeChat 2.2) |
02:15:09 | * | zachcarter quit (Ping timeout: 252 seconds) |
02:25:00 | * | kapil___ joined #nim |
02:32:45 | * | ftsf joined #nim |
02:34:40 | shashlick | Nice |
02:52:13 | FromGitter | <kayabaNerve> I asked this a few days ago and got no response. I know templates can't override `=` but I don't see this as impossible. ⏎ ⏎ How can I write a = overload for a generic? ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/nim-lang/Nim?at=5b9c73dd1ee2ca65021b010c] |
02:52:45 | * | wildlander quit (Quit: Konversation terminated!) |
02:53:37 | FromGitter | <kayabaNerve> First says it doesn't match the signature. Second says X is undefined. Third compiles but is ignored. |
02:55:39 | FromGitter | <kayabaNerve> Even ``` ⏎ proc `=`(x: var Generic[int], y: Generic[T]) ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5b9c74aabe4f30062696f757] |
02:56:16 | FromGitter | <kayabaNerve> *both would be int in that last one. |
02:56:22 | AlexMax | damn |
02:56:27 | AlexMax | heck yeah |
02:56:37 | AlexMax | Got rid of the obvious syntax errors |
02:56:48 | AlexMax | now on to the actual compile errors |
02:57:50 | AlexMax | just in case i lose power... |
02:57:53 | AlexMax | https://paste.ee/p/Nbzd2 |
02:58:00 | FromGitter | <kayabaNerve> It does work if I use any symbol other than =... |
03:17:13 | * | PrimHelios joined #nim |
03:17:15 | PrimHelios | mew mew |
03:17:18 | PrimHelios | long time no mew |
03:19:20 | PrimHelios | WRONG SERVER |
03:22:46 | * | francisl joined #nim |
03:26:01 | AlexMax | ...okay this is kind of bizarre |
03:26:25 | AlexMax | I'm getting an error dump trying to compile nimnuklear_nuklear |
03:26:33 | AlexMax | .c |
03:26:58 | AlexMax | says it can't find a bunch of type names that 100% do exist |
03:27:02 | AlexMax | https://paste.ee/p/38rgZ |
03:28:09 | FromGitter | <bung87> how to determin x64 or x86 32? |
03:28:33 | AlexMax | Oh shoot |
03:30:54 | AlexMax | what the heck kind of codegen is this... |
03:31:34 | AlexMax | Some of these typedefs are backwards |
03:31:42 | AlexMax | Or something |
03:33:18 | AlexMax | No wait, they're not backwards. They're missing the 'struct' keyword |
03:34:49 | AlexMax | shoot, if you wrap a c struct, you need to .importc "struct foo", don't you... |
03:40:12 | * | francisl quit (Quit: francisl) |
03:40:55 | FromGitter | <kungtotte> I've been scouring the documentation and the forums and I'm coming up short, but is there a straightforward way of writing the equivalent to this C# code in nim: bytes[] = BitConverter.GetBytes(unsigned_integer, length) |
03:41:50 | FromGitter | <kungtotte> What it does is it takes each byte in turn from an int (up to length bytes) |
03:43:15 | AlexMax | Yep, importc needs "struct" |
03:43:22 | AlexMax | C is dumb lol |
03:43:51 | * | francisl joined #nim |
03:49:57 | FromGitter | <bung87> @kungtotte you can try cast it to array of char |
03:52:18 | AlexMax | okay, I'm all nimmed out today |
03:53:00 | FromGitter | <kungtotte> @bung87 Something like this? castarray[4, uint8 (value) |
03:53:24 | AlexMax | at least I've got this pushed remotely |
03:53:32 | FromGitter | <kungtotte> Uh, that looks like it got formatted weirdly. Not used to gitter on my phone |
03:53:47 | FromGitter | <bung87> `cast[array[4, uint8]]` |
03:55:06 | AlexMax | also I have no idea how I'm supposed to get at the scancodes in the sdl2 package, but maybe I haven't looked hard enough |
03:55:20 | AlexMax | seems like they're all in the private section |
03:55:32 | FromGitter | <bung87> oh it's `char` type not uint8 |
04:06:07 | * | francisl quit (Quit: francisl) |
04:20:15 | * | dddddd quit (Remote host closed the connection) |
04:51:04 | FromGitter | <kungtotte> Isn't `char` an alias for `uint8`? |
04:53:54 | * | miran joined #nim |
05:00:46 | * | erratic quit (Ping timeout: 246 seconds) |
05:08:39 | * | nsf joined #nim |
05:22:47 | FromGitter | <bung87> not sure about how the type infered |
05:26:07 | FromGitter | <kaushalmodi> @Araq Before I create a PR for nightly docs, I noticed that the internal links to modules is incorrect when building docs on Travis. For example, in https://kaushalmodi.github.io/nim-nightly-docs/cpuinfo.html, it is: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9c97eeb9531f2dfa6c430b] |
05:26:36 | FromGitter | <kaushalmodi> What would cause that `lib/pure/concurrency/` hierarchy to go missing? |
05:27:03 | FromGitter | <kaushalmodi> Another issue that I see both locally and on Travis is that it's pointing to `tree/master` instead of `tree/GITHASH`. |
05:33:34 | * | cspar quit (Ping timeout: 272 seconds) |
05:33:48 | * | nsf quit (Quit: WeeChat 2.2) |
05:35:00 | FromGitter | <kaushalmodi> The links under "Imports" are broken too, when generating koch docs on Travis (see that same cpuinfo page) |
05:38:09 | FromGitter | <kaushalmodi> Actually, I am now able to recreate that issue locally too. |
06:01:08 | * | xet7 joined #nim |
06:03:52 | * | NimBot joined #nim |
06:11:10 | * | zachcarter joined #nim |
06:15:45 | * | zachcarter quit (Ping timeout: 244 seconds) |
06:20:01 | FromGitter | <alehander42> @Araq yeah indexes vs pointers, but the point seemed to be that if you are not managing your indexes correctly, you can and up with incorrect index state without any type checker or runtime exception showing that |
06:27:50 | * | travelion joined #nim |
06:32:13 | * | Atque joined #nim |
06:32:34 | * | travelion quit (Ping timeout: 240 seconds) |
06:38:07 | * | Atque quit (Ping timeout: 240 seconds) |
06:52:37 | FromGitter | <alehander42> btw is there a problem with supporting e.g. a.`__enter__` in nim |
06:52:41 | FromGitter | <alehander42> ops |
06:52:52 | FromGitter | <alehander42> ```a.`_enter```` |
06:53:47 | FromGitter | <alehander42> it seems the quotes also accepts only valid names, but it should be easy to make them accept more characters: it would make sense for js backend or nimpy: https://github.com/yglukhov/nimpy/issues/43 |
06:58:10 | FromGitter | <alehander42> pff, i didnt know of eqIdent .. |
06:58:25 | FromGitter | <alehander42> (looking at mratsim's julia challenge) |
06:59:11 | FromGitter | <bung87> seems template and block similar to this |
07:04:05 | FromGitter | <alehander42> ? |
07:06:07 | * | miran quit (Ping timeout: 240 seconds) |
07:06:23 | FromGitter | <bung87> just thoughts , implements a `with` macro and `context.__enter` `body` `context.__leave__` |
07:08:33 | FromGitter | <alehander42> ah yeah |
07:09:02 | FromGitter | <alehander42> we even did that automatically in py2nim, we translated python context managers to stuff like https://github.com/metacraft-labs/py2nim/blob/master/tests/nim/context.nim |
07:10:15 | FromGitter | <bung87> oh ,why not use py2nim then = _= |
07:10:34 | FromGitter | <alehander42> well it's very unfinished |
07:11:10 | FromGitter | <alehander42> and it will always require at least a bit of manual postprocessing |
07:11:46 | FromGitter | <alehander42> and for libs it's usually better to design them with nim types and metaprogramming in mind, not to automatically simulate the python way |
07:12:45 | FromGitter | <bung87> I'm not confortable with import a python dylib |
07:13:43 | FromGitter | <bung87> comfortable |
07:14:03 | FromGitter | <alehander42> i guess in some cases it's fine |
07:15:15 | * | Te[u]K20 joined #nim |
07:15:59 | FromGitter | <bung87> in python there's GIL in import a dylib |
07:19:58 | * | Te[u]K20 quit (Remote host closed the connection) |
07:20:19 | * | krowthulhu26 joined #nim |
07:20:59 | * | erratic joined #nim |
07:23:08 | * | cavariux quit (Remote host closed the connection) |
07:24:03 | * | cavariux joined #nim |
07:25:04 | * | krowthulhu26 quit (Remote host closed the connection) |
07:41:38 | * | TheLemonMan joined #nim |
07:44:56 | TheLemonMan | devel is red again FFS :( |
07:57:21 | * | edi27 joined #nim |
07:57:59 | * | edi27 quit (Remote host closed the connection) |
07:58:33 | * | SenasOzys joined #nim |
08:01:11 | * | Guest8490 is now known as awal |
08:03:07 | * | gmpreussner quit (Ping timeout: 240 seconds) |
08:03:29 | * | gmpreussner joined #nim |
08:04:12 | Araq | alehander42: well yeah, you add a "generation" part to the index |
08:04:56 | Araq | and you still have no security violations, no remote exploits... |
08:17:22 | * | _brainbomb_ joined #nim |
08:24:01 | * | xet7 quit (Quit: Leaving) |
08:25:03 | * | ftsf quit (Ping timeout: 245 seconds) |
08:27:20 | * | xet7 joined #nim |
08:36:06 | * | _brainbomb_ quit (Ping timeout: 252 seconds) |
08:47:03 | * | Vladar joined #nim |
08:49:32 | * | PMunch joined #nim |
08:50:33 | FromGitter | <bung87> https://github.com/Nim-NLP/minhash/blob/master/src/minhash.nim does it necessary define two versions of interfaces ? |
08:51:36 | FromGitter | <mratsim> you can use `MinHasher[T: uint32 or uint64]` if you want |
08:53:18 | FromGitter | <bung87> wow let me try will reduce much code |
08:54:01 | * | ftsf joined #nim |
08:58:35 | FromGitter | <Bennyelg> How I can do that: ⏎ type ⏎ SimpleTest = ref object ⏎ ⏎ ```execute: proc()``` [https://gitter.im/nim-lang/Nim?at=5b9cc9bbbe4f30062698b912] |
09:04:39 | FromGitter | <Vindaar> @Bennyelg: what do you mean? That's perfectly valid |
09:07:52 | FromGitter | <Vindaar> to expand on that: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ is fine. Or did you have something else in mind? [https://gitter.im/nim-lang/Nim?at=5b9ccbe73b7e6c2edd1da953] |
09:08:21 | FromGitter | <Bennyelg> this is probably the behavior I want |
09:08:23 | FromGitter | <Bennyelg> but . i get incorrect object construction syntax |
09:09:26 | FromGitter | <Bennyelg> fixed |
09:09:31 | FromGitter | <Bennyelg> I forgot keyword |
09:09:58 | FromGitter | <Vindaar> ah :) |
09:15:23 | * | abm joined #nim |
09:18:55 | FromGitter | <Bennyelg> @Vindaar ⏎ I can't do something like this? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cce7ff7e1580625d43339] |
09:20:42 | FromGitter | <Bennyelg> I just removed the ref |
09:20:47 | FromGitter | <Bennyelg> and it's working |
09:22:09 | FromGitter | <Vindaar> do you want your different strategies to be just different aliases or actually objects inheriting from `Strategy`? |
09:22:46 | FromGitter | <Bennyelg> object inheriting from Strategy I am trying to mimic strategy pattren in nim |
09:23:06 | FromGitter | <Bennyelg> looks like I did it |
09:23:06 | FromGitter | <mratsim> I sense Java-ism distrubance in the Force |
09:23:15 | FromGitter | <Bennyelg> lol |
09:23:21 | FromGitter | <Bennyelg> just practice |
09:23:23 | FromGitter | <Bennyelg> nothing more |
09:23:33 | FromGitter | <mratsim> ugh, don’t practice Java in Nim :P |
09:23:38 | FromGitter | <Bennyelg> lol |
09:23:54 | FromGitter | <mratsim> Patterns mean you’re language is not powerful enough ;) |
09:23:57 | FromGitter | <Bennyelg> I was urgy with friend which is fun of Kotlin, that I can do anything better |
09:24:05 | FromGitter | <Vindaar> In the example above all your different strategies are just aliases of the same thing, a `ref Strategy`. If you want to inherit from them, you'll have to write `ref object of Strategy`, no? (I've never used inheritance in Nim before, just my little understanding) |
09:24:19 | FromGitter | <mratsim> read that by the way, it’s fun: https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html |
09:24:45 | FromGitter | <mratsim> for inheritance Strategy must be a ref object of RootObj |
09:25:02 | FromGitter | <mratsim> and everything else ref object of Strategy |
09:25:13 | FromGitter | <Bennyelg> yea i got this to work |
09:25:17 | FromGitter | <Vindaar> ah, indeed :) |
09:26:04 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cd02cbe4f30062698da58] |
09:27:11 | FromGitter | <mratsim> but your types are all aliases |
09:27:31 | FromGitter | <mratsim> well I don’t know the strategy patter so whatever :P |
09:27:35 | FromGitter | <mratsim> pattern* |
09:28:39 | FromGitter | <mratsim> according to wikipedia "The strategy pattern uses composition instead of inheritance" |
09:29:48 | FromGitter | <mratsim> but it seems like you can use this: ⏎ ⏎ ```type ⏎ Strategy = object ⏎ name: string ⏎ selectedStrat: proc ()``` ⏎ ⏎ No need for anything else [https://gitter.im/nim-lang/Nim?at=5b9cd10cd655361f7601ed40] |
09:29:59 | FromGitter | <mratsim> it’s just a proc handler |
09:30:09 | FromGitter | <Bennyelg> just pass proc |
09:30:25 | FromGitter | <mratsim> you don’t need all those extra types |
09:30:33 | FromGitter | <Bennyelg> yea I understand |
09:30:34 | FromGitter | <Bennyelg> you are right |
09:31:07 | FromGitter | <bung87> ```lib/pure/collections/sets.nim(480, 15) Error: type mismatch: got <HashSet[system.uint64]>``` ⏎ ⏎ why this happen? [https://gitter.im/nim-lang/Nim?at=5b9cd15b8909f71f75d87f93] |
09:31:26 | FromGitter | <mratsim> uint64 might not be Hashable |
09:31:49 | FromGitter | <mratsim> ah they are |
09:32:03 | FromGitter | <mratsim> but your stacktrace is too short |
09:32:19 | FromGitter | <mratsim> must go though, I can’t help right now |
09:32:46 | FromGitter | <Bennyelg> @mratsim thanks for help |
09:33:00 | FromGitter | <mratsim> you’re welcome |
09:33:10 | FromGitter | <bung87> when it calling ``` ⏎ ⏎ `````` ⏎ when it compute intersection [https://gitter.im/nim-lang/Nim?at=5b9cd1d6b4990c30eebb28c2] |
09:33:57 | FromGitter | <bung87> previous with two version interface has no such problem. |
09:34:19 | FromGitter | <mratsim> intersection is called intersection not `/` |
09:34:32 | FromGitter | <mratsim> ah no I see |
09:34:41 | FromGitter | <mratsim> intersection returns a `/` |
09:34:45 | FromGitter | <mratsim> a HashSet |
09:34:55 | FromGitter | <mratsim> but there is no `/` defines for HasSet |
09:35:15 | FromGitter | <bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cd2533b7e6c2edd1dcc43] |
09:35:24 | FromGitter | <mratsim> ah no there is a len before, well, sorry can’t really help but type issues should be easy |
09:35:46 | * | klaas__ joined #nim |
09:35:59 | FromGitter | <mratsim> also don’t forget to convert len to float |
09:36:37 | FromGitter | <bung87> but it will raise before that |
09:37:23 | FromGitter | <Vindaar> in which line does it raise? That's not clear from the single line of the stack trace |
09:37:59 | FromGitter | <bung87> ok let me put all |
09:38:13 | FromGitter | <bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cd305e5c2cc56ad9207a7] |
09:38:38 | * | klaas__ quit (Remote host closed the connection) |
09:39:26 | FromGitter | <alehander42> what does fingerprint return |
09:40:33 | FromGitter | <bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9cd3918909f71f75d88a00] |
09:41:10 | FromGitter | <bung87> ok , I update it https://github.com/Nim-NLP/minhash/blob/master/src/minhash.nim |
09:50:25 | FromGitter | <bung87> kinda weird,what could be a problem between same type sets intersection... |
09:51:32 | FromGitter | <Vindaar> so the issue happens in the call to intersection? |
09:56:43 | FromGitter | <bung87> ```code paste, see link``` ⏎ ⏎ after init the first call is .jaccard , then it throw error from std lib nothing more useful info. [https://gitter.im/nim-lang/Nim?at=5b9cd75b7dca306503044a12] |
09:59:05 | FromGitter | <Vindaar> If you tell me how I can run that code locally, I'll take a look. But the github link is missing that `murmur3` module |
10:00:16 | FromGitter | <bung87> yeah , I renamed it ,forget to push , now updated. |
10:01:47 | * | miran joined #nim |
10:02:25 | FromGitter | <bung87> now you can run it as usual |
10:03:44 | FromGitter | <Vindaar> it compiles just fine for me? |
10:04:46 | FromGitter | <bung87> you passed test1.nim ? |
10:05:08 | FromGitter | <Vindaar> ahh, I thought the `isMainModule` part of `minhash.nim` was enough :) |
10:06:09 | FromGitter | <Vindaar> your problem is that you don't import `sets` into `test1.nim` |
10:06:31 | FromGitter | <Vindaar> either export `sets` from `minhash.nim` or you need to import it into every module that uses `minhash` |
10:08:42 | FromGitter | <bung87> oh . but test1.nim doest declared any HashSet , why need that? |
10:11:39 | * | zachcarter joined #nim |
10:11:47 | * | stefanos82 joined #nim |
10:16:06 | * | zachcarter quit (Ping timeout: 252 seconds) |
10:18:36 | FromGitter | <bung87> @mratsim @Vindaar thank you guys! now it reduce code less than 100 lines:) |
10:19:14 | FromGitter | <Vindaar> happy to help :) I can't properly answer the `why` though. It's just how scoping / imports work in Nim I think? |
10:21:16 | FromGitter | <bung87> before this, I have two version interfaces, not use generic, so when it comes to generic ,it acts this way? |
10:21:41 | FromGitter | <Vindaar> yeah, it might be related to how generics are instantiated |
10:22:31 | FromGitter | <bung87> that makes it like a runtime importing : ( |
10:23:18 | FromGitter | <Vindaar> well, in practice it's not really an issue imo |
10:23:43 | FromGitter | <bung87> ok I got it. |
10:28:00 | * | nsf joined #nim |
10:31:44 | FromGitter | <dm1try> > It's just how scoping / imports work in Nim I think? ⏎ ⏎ actually looks like a bug.. why someone should import `sets` module it is just an implementations details of `minhash` |
10:33:10 | FromGitter | <dm1try> and this is related only to the `items` iterator; there is no problem with other methods |
10:33:32 | FromGitter | <dm1try> nope? |
10:34:00 | FromGitter | <Vindaar> I don't know. I stumbled on this myself quite a few times and just accepted it |
10:34:24 | FromGitter | <bung87> good to know.. |
10:34:35 | FromGitter | <dm1try> hm.. happy you =) I cannot accept such behaviour |
10:34:50 | FromGitter | <Vindaar> then please raise an issue about it :) |
10:35:01 | FromGitter | <Vindaar> I mean I'd be happy if it's just a bug :D |
10:36:47 | FromGitter | <Vindaar> there's an even more subtle way this can occur (which I did think was a bug before), but I never spent enough time to figure out how to reproduce it in a simple way |
10:40:50 | FromGitter | <bung87> `Issues 1,410` much more than most popular projects... |
10:41:08 | FromGitter | <dm1try> yep, it makes sense, I will try to reproduce and find or file an new issue then |
10:44:15 | FromGitter | <Vindaar> 👍 |
10:48:09 | * | PMunch quit (Remote host closed the connection) |
10:54:35 | FromGitter | <dm1try> https://github.com/nim-lang/Nim/issues/4773 |
10:54:42 | FromGitter | <dm1try> this is the related issue |
10:55:11 | FromGitter | <dm1try> and the solution that proposed by Araq is works |
10:56:10 | FromGitter | <dm1try> if you change this line https://github.com/nim-lang/Nim/blob/devel/lib/pure/collections/sets.nim#L480 to use explicit `items` iterator |
10:56:22 | FromGitter | <dm1try> you do not need to import `sets` |
10:56:26 | Araq | yeah, we should fixt that, but it's hard :P |
10:57:14 | TheLemonMan | gotta run more of the lib/pure stuff in the test suite |
10:58:00 | * | ftsf quit (Ping timeout: 252 seconds) |
10:59:25 | TheLemonMan | is there a way to grab an anonymous ident in a macro? |
11:00:13 | Araq | gensym() |
11:06:20 | TheLemonMan | Araq, I'm curious about what the rationale behind the choice of having the field name only in nkCheckedFieldExpr is :) |
11:11:24 | Araq | guide the implementation into not evaluating 'f' twice in f().checkedField |
11:12:47 | TheLemonMan | hm, I can implement that in the VM if you want |
11:13:07 | FromGitter | <codenoid> btw @Bennyelg about csv parsing |
11:13:17 | FromGitter | <codenoid> i let my user to define the separator |
11:14:05 | * | kapil___ quit (Quit: Connection closed for inactivity) |
11:14:09 | FromGitter | <Bennyelg> @codenoid I'll add this option |
11:16:35 | FromGitter | <codenoid> https://github.com/Muonyet/lazy-mongo |
11:17:18 | FromGitter | <codenoid> https://github.com/Muonyet/lazy-mongo#usage |
11:28:19 | FromGitter | <Bennyelg> nice |
11:28:35 | FromGitter | <Bennyelg> nice but you should ditch crystal and move to Nim :P |
11:36:40 | * | demotomohiro joined #nim |
12:10:42 | * | kapil___ joined #nim |
12:21:44 | * | ericbmerritt_24 joined #nim |
12:26:31 | * | ericbmerritt_24 quit (Remote host closed the connection) |
12:32:23 | * | Vladar quit (Remote host closed the connection) |
13:00:18 | * | SenasOzys quit (Ping timeout: 244 seconds) |
13:05:20 | FromGitter | <tim-st> when I have a threadvar but `--threads:off` is there a difference to a normal var that is inside a proc? |
13:10:06 | * | SenasOzys joined #nim |
13:23:48 | FromGitter | <tim-st> ok, here is an answer for delphi, though not very clear: https://stackoverflow.com/questions/5180933/what-is-the-difference-between-a-threadvar-and-a-local-variable |
13:23:54 | * | nsf quit (Quit: WeeChat 2.2) |
13:25:10 | FromGitter | <Bennyelg> anyone can throw an example? ⏎ https://github.com/nim-lang/Nim/issues/8944 |
13:25:40 | FromGitter | <Bennyelg> passing function to aggregate a seq ? this is what it means? |
13:26:29 | FromGitter | <bung87> maybe groupBy ( proc(x): x["myindex"]) |
13:28:21 | * | TheLemonMan quit (Ping timeout: 252 seconds) |
13:35:23 | FromGitter | <Bennyelg> but it's seq |
13:37:18 | * | halirc joined #nim |
13:37:30 | FromGitter | <bung87> oh ,then I can assuming he means seq of seq. |
13:37:55 | FromGitter | <bung87> no ,also not right.. |
13:38:44 | halirc | Hello. Is anyone with the nim json module? |
13:38:48 | halirc | *familiar |
13:38:55 | FromGitter | <bung87> seq of tables sounds make sense. |
13:40:04 | halirc | I'm wondering if it would be difficult to sort hashes in existing json files by key name and write them back out sorted |
13:43:09 | FromGitter | <bung87> halirc there's no order in javascript object keys , so .. |
13:45:14 | FromGitter | <bung87> if you handle json files , then that could be possible, just scan "somkey": if it's not nested object that would be simple. |
13:45:26 | halirc | well, they say the order is not guaranteed and it isn't, but in the file you write out you have an order of the keys just by the way it was writen. I would like that order to be the same always to better put those files into version control |
13:47:59 | FromGitter | <bung87> you may try https://github.com/Araq/packedjson/ since it store json as a single string. |
13:54:21 | * | TheLemonMan joined #nim |
14:04:56 | * | zachcarter joined #nim |
14:15:04 | * | wildlander joined #nim |
14:23:42 | * | PrimHelios quit (Ping timeout: 252 seconds) |
14:27:32 | * | stefanos82 quit (Read error: Connection reset by peer) |
14:29:14 | * | stefanos82 joined #nim |
14:31:00 | * | Vladar joined #nim |
15:06:39 | * | elrood joined #nim |
15:08:30 | TheLemonMan | I've just pushed an update to criterion.nim, the measureArg annotation is now gone :D |
15:10:36 | * | nsf joined #nim |
15:11:26 | * | cspar joined #nim |
15:15:50 | FromGitter | <alehander42> Araq is [expr] [expr] guaranteed to work as command in ast |
15:16:15 | FromGitter | <alehander42> i was surprised even `2 @b` works while doing pattern matching experiments |
15:16:36 | FromGitter | <alehander42> so e.g. `of expr @name` seems to be always valid ast |
15:17:25 | FromGitter | <alehander42> i am not sure why i am surprised: i guess i expected literals etc to be detected as i thought nnkCommand is only for invocations of the left operand |
15:26:57 | * | Calinou quit (Ping timeout: 252 seconds) |
15:32:27 | * | Calinou joined #nim |
15:37:45 | Araq | the "command invokation syntax" got greatly improved with the 'await' "keyword" |
15:38:44 | FromGitter | <alehander42> I see |
15:39:26 | * | SenasOzys quit (Ping timeout: 244 seconds) |
15:47:39 | FromGitter | <Bennyelg> this is what he ment ? ⏎ https://github.com/nim-lang/Nim/issues/8944 |
15:51:07 | FromGitter | <Vindaar> @Bennyelg I would guess he means something like: https://clojuredocs.org/clojure.core/group-by |
15:51:38 | FromGitter | <bung87> guess so,may prefer return a table with group key |
15:52:21 | FromGitter | <Vindaar> i.e. input is some `seq[T]` as well as some proc taking `T` and returning U. Then group all elements of the input by the result of the proc (the key) to get a `Table[U, seq[T]]` |
15:53:26 | FromGitter | <Bennyelg> @Vindaar I thought he was thinking something like itertools.groupBy (python)\ |
15:53:49 | FromGitter | <Vindaar> ok that Python proc I don't know :D |
15:55:47 | FromGitter | <Bennyelg> clojure groupBy is cool |
15:55:49 | FromGitter | <bung87> prefer think it means sonething in functional programing in scala or some other |
15:57:21 | miran | @Benyelg: the input seq shouldn't be limited to `seq[Table]` |
15:57:35 | FromGitter | <Bennyelg> Yea I guess you are right |
15:57:43 | FromGitter | <Bennyelg> seq[T] indeed |
15:59:40 | miran | @Vindaar: python.itertools is a great (very powerful) library! there's no excuse to not know everything in it by heart! :P |
16:00:17 | FromGitter | <Vindaar> miran: haha you're probably right. :D I know itertools, but I only used it sparingly |
16:01:52 | miran | @Bennyelg but thanks for reminding me that i didn't implement groupBy in https://github.com/narimiran/itertools |
16:03:16 | FromGitter | <Vindaar> ```code paste, see link``` ⏎ ⏎ I guess? And why can `len` not be handed as a `procvar`? [https://gitter.im/nim-lang/Nim?at=5b9d2d448909f71f75da8fa3] |
16:03:58 | FromGitter | <Bennyelg> cool I am just writing the same now lol |
16:04:02 | FromGitter | <Vindaar> haha :D |
16:04:08 | FromGitter | <Bennyelg> what is keyP ? |
16:04:10 | FromGitter | <Vindaar> always fun to implement something like this :) |
16:04:12 | FromGitter | <Bennyelg> another function? |
16:04:14 | FromGitter | <Vindaar> `key proc` |
16:04:14 | FromGitter | <Bennyelg> yea |
16:04:21 | FromGitter | <Bennyelg> oh |
16:04:22 | FromGitter | <Vindaar> that was supposed to go in `"` |
16:04:23 | FromGitter | <Bennyelg> didnt saw it |
16:04:31 | FromGitter | <Bennyelg> Awesome |
16:06:08 | FromGitter | <bung87> cool ,you do it so quick |
16:06:23 | FromGitter | <Bennyelg> yea I just wrote the first 2 lines |
16:06:29 | FromGitter | <Bennyelg> and they looks almost the same lol |
16:06:38 | FromGitter | <Bennyelg> but it's fine I am learning and seeing Im in the right path lol |
16:06:57 | FromGitter | <Vindaar> hehe 🙈 |
16:07:24 | FromGitter | <Bennyelg> 🔨 |
16:10:57 | * | SenasOzys joined #nim |
16:15:13 | FromGitter | <Bennyelg> ```code paste, see link``` ⏎ ⏎ looks good thanks @Vindaar [https://gitter.im/nim-lang/Nim?at=5b9d3011be4f3006269af363] |
16:15:56 | FromGitter | <Vindaar> cool :) |
16:16:18 | FromGitter | <tim-st> `marshal.$$` dont support non-ascii field names? :( |
16:16:28 | miran | @Vindaar @Bennyelg can i use your versions as a basis for itertools.groupBy? |
16:16:31 | FromGitter | <Bennyelg> Comment this pull request with your solution or just make a pull request with this groupBy inside the collections :D |
16:16:46 | FromGitter | <Bennyelg> I guess you could |
16:16:55 | FromGitter | <Vindaar> sure thing! |
16:17:05 | FromGitter | <Bennyelg> just start coding Muhahaha |
16:17:44 | * | stefanos82 quit (Quit: Quitting for now...) |
16:19:23 | TheLemonMan | tim-st, if Nim supports them then marshal must support those too |
16:19:47 | FromGitter | <Bennyelg> https://github.com/nim-lang/Nim/issues/8944 ⏎ credit to @Vindaar ;] |
16:22:03 | TheLemonMan | why split ` ... = @[]/ ... .add(el)`? that way you do two lookups in the table |
16:22:26 | FromGitter | <Vindaar> because real quick I didn't know how else to do it |
16:22:37 | TheLemonMan | @[el] ? |
16:22:45 | FromGitter | <Bennyelg> hehe |
16:22:47 | FromGitter | <Vindaar> Oh |
16:22:48 | FromGitter | <Vindaar> haha |
16:22:52 | FromGitter | <Vindaar> indeed :D |
16:23:03 | FromGitter | <Bennyelg> when things are so easy we always look for hard solution |
16:23:13 | FromGitter | <Bennyelg> complicated * |
16:23:49 | FromGitter | <tim-st> TheLemonMan: it works indeed, I had to add "Content-Type: application/json" to the request to get it correct |
16:25:10 | FromGitter | <bung87> it is easy make it more compilcated, support custom obj |
16:25:54 | copygirl | While away from the computer, I just realized the reason why I've been getting a proc mismatch error. |
16:26:13 | copygirl | I have a camera module and an exported camera variable inside that. |
16:26:40 | copygirl | Trying to write `camera.update()` doesn't work because that camera refers to the module. |
16:26:56 | FromGitter | <bung87> no not meant to send the message... |
16:27:47 | copygirl | I feel like there should be a more useful error message / hint or perhaps an error / hint in the module where I define the variable. |
16:29:32 | FromGitter | <tim-st> when my database is a threadvar and it does locking internally does it mean my application is ready for multithreading? (I have no warnings when compiling with `--threads:on`) |
16:31:05 | FromGitter | <bung87> to copygirl that might be IDE job |
16:31:17 | TheLemonMan | copygirl, I think the compiler should be smart enough to consider the symbol as ambiguous and to require it to be fully qualified |
16:31:37 | TheLemonMan | tim-st, threadvar means each thread gets a copy of the variable, that's it |
16:32:16 | copygirl | TheLemonMan: How would you even fully qualify a module? |
16:32:54 | TheLemonMan | copygirl, you don't, but you can't use `camera` and have to use `camera.camera` instead |
16:33:30 | FromGitter | <tim-st> TheLemonMan: yes I meant my database app locks internally, I dont understand why a threadvar is different from non threadvar though... |
16:34:15 | FromGitter | <tim-st> I mean why i get a warning when it's not threadvar and at global scope |
16:34:38 | TheLemonMan | tim-st, thread-vars are allocated in the TLS so each thread is free to do whatever it pleases |
16:35:42 | FromGitter | <tim-st> yes, I understand what this means for a string, but when I have a database handle what makes this more secure? |
16:36:46 | TheLemonMan | no, it just means you have N database handles (where N is the number of threads) |
16:37:30 | FromGitter | <tim-st> yes, I understand this too, but what makes it better than 1 db handle? I assume they all have the same content independent on threadvar or non threadvar |
16:38:12 | TheLemonMan | nobody said it is better :) |
16:38:46 | FromGitter | <tim-st> the compiler says it only allows threadvars, and I dont understand why |
16:39:03 | TheLemonMan | does it? |
16:39:47 | FromGitter | <tim-st> yes, once it's at global scope. When I do the same strucure and put a proc around everything stays without wanring. Without threadvar + global scope gives compiler error |
16:39:51 | miran | @Bennyelg @Vindaar i'll also add a variant of groupby without a `proc` parameter — the same elements will be grouped together |
16:40:22 | FromGitter | <tim-st> TheLemonMan: https://github.com/2vg/mofuw/issues/62 |
16:41:04 | FromGitter | <tim-st> the same when I just make `l = s.len` where s is from global scope |
16:52:45 | * | demotomohiro quit (Ping timeout: 252 seconds) |
16:56:55 | * | arecaceae quit (Remote host closed the connection) |
16:57:14 | * | arecaceae joined #nim |
17:09:18 | * | johnsom5 joined #nim |
17:10:48 | FromGitter | <Clyybber> !echo Test |
17:10:56 | FromGitter | <Clyybber> !nimbot echo Test |
17:11:59 | * | johnsom5 quit (Remote host closed the connection) |
17:14:26 | * | leorize joined #nim |
17:18:41 | FromGitter | <Clyybber> @Araq @zah @TheLemonMan ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ This crashes the compiler... [https://gitter.im/nim-lang/Nim?at=5b9d3ef1be4f3006269b48ea] |
17:19:05 | FromGitter | <Clyybber> Is a type annotation inside an array valid syntax? |
17:19:09 | FromGitter | <cfsamson> Anyone from the core team here? |
17:19:16 | * | rofer20 joined #nim |
17:19:37 | TheLemonMan | Clyybber, woah that's extra weird |
17:20:03 | TheLemonMan | cfsamson, there's Araq on call 24/7 |
17:21:17 | FromGitter | <Clyybber> @TheLemonMan Is the 7th line even valid syntax? |
17:22:06 | * | rofer20 quit (Remote host closed the connection) |
17:22:26 | TheLemonMan | Clyybber, not sure about that, but surely it shouldn't generate an array with a typedesc in it |
17:22:34 | FromGitter | <cfsamson> OK, so @Araq On the Nim homepage under "featured projects" the Reel Valley is a dead link, kust thought to let you know since it is on a prime location on the homepage ;) (facebook 404 response) |
17:24:33 | FromGitter | <Clyybber> @TheLemonMan Yeah its wierd. In the code I extracted the sample from it didn't crash, but complain that I passed in a ```ptr type num``` instead of a ```ptr num``` |
17:24:43 | TheLemonMan | Clyybber, good news, the syntax is fine but it doesn't do what you think it does |
17:24:53 | TheLemonMan | it's `<index>: <value>` |
17:25:02 | FromGitter | <Clyybber> Aha |
17:25:05 | FromGitter | <Clyybber> Cool |
17:25:21 | FromGitter | <Clyybber> So Its possible to have an array of types? |
17:26:10 | TheLemonMan | the language says yes, the codegen says no and Araq says ... |
17:27:42 | FromGitter | <Clyybber> I will see if I can make a test case where it doesn't crash, but instead generates a ```ptr type num``` |
17:28:22 | TheLemonMan | I guess not because it makes no sense to have an array of typedescs |
17:28:35 | FromGitter | <bung87> I think you are looking for typetraits or typeinfo |
17:29:26 | FromGitter | <Clyybber> @bung87 I don't WANT to use this code, I just happen to came across it |
17:30:30 | FromGitter | <bung87> ok |
17:32:22 | * | Jesin quit (Quit: Leaving) |
17:32:39 | FromGitter | <Clyybber> @TheLemonMan I succeeded |
17:33:55 | FromGitter | <Clyybber> Interestingly in a proc it doesn't crash the compiler: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9d4283b9531f2dfa6fff65] |
17:35:47 | FromGitter | <bung87> weird case... |
17:35:52 | FromGitter | <Clyybber> Yep |
17:36:23 | FromGitter | <Clyybber> A ```ptr type num``` doesn't make a whole lot of sense |
17:39:43 | * | Jesin joined #nim |
17:43:04 | * | halirc quit (Ping timeout: 246 seconds) |
17:48:33 | * | Roedy6 joined #nim |
17:51:19 | * | Roedy6 quit (Remote host closed the connection) |
18:04:31 | * | demotomohiro joined #nim |
18:04:38 | Araq | [0: 2] is a valid array literal iirc |
18:08:37 | def- | I see someone is having fun on the Nim wiki article and replaced all mentions of "compile" with "transpile". Description of the change is "Nim is transpiled, Not compiled, stop lying" :D |
18:10:46 | Araq | def-, thanks for pointing it out |
18:11:03 | dom96 | lol nice |
18:11:11 | FromGitter | <Clyybber> @Araq Notice that `num` is a type |
18:11:28 | Araq | Clyybber: yeah, a type is obviously not valid here |
18:11:36 | FromGitter | <kayabaNerve> Yo Ara |
18:11:41 | FromGitter | <kayabaNerve> *Araq |
18:12:16 | Araq | def-, er, my wiki skills are not good enough to find a list of changes |
18:13:10 | dom96 | I undid it |
18:13:25 | Araq | dom96, thanks, also report the user to github's admins |
18:13:37 | dom96 | github? |
18:13:47 | dom96 | It's an IP address anyway |
18:14:01 | dom96 | Hrm, not sure when the "Transpiler" section popped up |
18:14:02 | Araq | er |
18:14:22 | Araq | what article are we talking about? |
18:14:32 | Araq | github's wiki? wikipedia? |
18:14:49 | miran | wikipedia |
18:14:49 | FromGitter | <Clyybber> Githubs wiki |
18:14:54 | def- | https://en.wikipedia.org/w/index.php?title=Nim_(programming_language)&diff=859682685&oldid=859682234 |
18:14:56 | dom96 | Oh i see. |
18:15:05 | FromGitter | <Clyybber> Nvrmind |
18:15:14 | def- | Also now references Rust as an influence: https://en.wikipedia.org/w/index.php?title=Nim_(programming_language)&diff=859682820&oldid=859682685 |
18:15:22 | dom96 | I undid it all |
18:16:02 | dom96 | if it continues we can ask Wikipedia admins to lock it] |
18:16:26 | Araq | lock it already and report the user |
18:17:11 | miran | oh oh, look at other contributions from the same IP |
18:17:22 | miran | removing mentions of Nim on other articles |
18:17:53 | def- | Removing mentions of Nim everywhere on Wikipedia |
18:18:10 | miran | ok, somebody is very hurt by nim. Araq what did you do to him? :D |
18:18:45 | dom96 | oh :( |
18:18:48 | dom96 | That really sucks :( |
18:19:02 | Araq | I did nothing. |
18:19:38 | miran | Araq: are you sure you didn't offend somebody? :D c'mon man, we all know you :P |
18:19:48 | dom96 | miran: Hey, that's not nice. |
18:20:01 | FromGitter | <Clyybber> @miran It is not Araq's job not to offend people |
18:20:01 | miran | (i'm joking, if that's not obvious) |
18:20:11 | FromGitter | <Clyybber> Oh, |
18:20:22 | dom96 | Even if it's a joke, it's still not nice. |
18:20:24 | FromGitter | <Clyybber> well :D |
18:20:27 | miran | @Clyybber don't worry, i'm on his side :) |
18:20:34 | Araq | even if I did that's no reason to go into troll beserker mode |
18:21:26 | Araq | shouldn't there be a review process on Wikipedia article changes? |
18:21:37 | def- | only if an article had previous vandalism |
18:21:51 | dom96 | well, I asked in #wikipedia |
18:22:07 | miran | dom96: Araq: sorry, i really didn't mean anything bad, just a (bad) joke, really |
18:22:11 | def- | https://en.wikipedia.org/wiki/Wikipedia:Reviewing_pending_changes |
18:22:42 | Araq | don't worry, miran, it's fine. I know I can hurt people by being right. |
18:22:48 | dom96 | miran: It's okay. I just wouldn't like to be known as someone who offends people, even if it's a joke. I think Araq might feel the same. |
18:22:54 | FromGitter | <kayabaNerve> Anyone here know what folder the operator overloading (specifically =) tests are under? |
18:23:03 | Araq | destructor/ |
18:23:07 | FromGitter | <kayabaNerve> Well. I'm sure someone knows. Anyone gere mind telling me? |
18:23:08 | FromGitter | <kayabaNerve> Thanks |
18:23:15 | miran | dom96: heh, i thought Araq enjoys that reputation :) |
18:23:21 | TheLemonMan | many enemies, much honor |
18:23:37 | Araq | miran, I don't really care tbh. :-) |
18:25:11 | FromGitter | <Epictek> "(Nim is transpiled, Not compiled, stop lying)" wowie |
18:26:09 | dom96 | mod in #wikipedia rolled back their other changes |
18:26:10 | dom96 | :) |
18:26:16 | FromGitter | <kayabaNerve> Araq So the tests seem to fail. |
18:26:43 | Araq | λ tt destructor |
18:26:43 | Araq | PASS: tatomicptrs.nim C (2.15376067 secs) |
18:26:43 | Araq | PASS: tcustomseqs.nim C (1.10206389 secs) |
18:26:43 | Araq | PASS: tcustomstrings.nim C (0.93250632 secs) |
18:26:43 | Araq | SKIP: tdestructor.nim C |
18:26:44 | Araq | PASS: tdestructor3.nim C (0.92104244 secs) |
18:26:46 | Araq | PASS: tmove_objconstr.nim C (0.98786497 secs) |
18:26:46 | FromGitter | <kayabaNerve> Sorry. Let me declare the topic. The tests that exemplify the overloading of = for a Generic. |
18:26:48 | Araq | PASS: topttree.nim C (0.91057825 secs) |
18:26:50 | Araq | PASS: turn_destroy_into_finalizer.nim C (1.16489625 secs) |
18:26:53 | TheLemonMan | do we really align parameters to the opening brace in stdlib? |
18:27:07 | FromGitter | <kayabaNerve> They don't fail in that sense. |
18:27:10 | dom96 | Araq: pastebin |
18:27:16 | FromGitter | <kayabaNerve> I'm saying the declared = overload don't work. |
18:27:41 | Araq | dom96, the next time. |
18:27:49 | FromGitter | <kayabaNerve> In `tatomicptrs.nim`, if you have the = operator print something distinct, you can see its never printed. |
18:28:05 | FromGitter | <kayabaNerve> Or at least on my compiler from the 11th. I should upgrade... |
18:28:06 | dom96 | TheLemonMan: yes |
18:28:16 | dom96 | It's certainly not done how you've indented it |
18:28:34 | FromGitter | <kayabaNerve> NVM. I messed up. |
18:28:35 | FromGitter | <kayabaNerve> Sorry. |
18:28:40 | FromGitter | <kayabaNerve> Trust in Araq, our BDFL. |
18:29:25 | TheLemonMan | I indent my own code however the fuck I like, I just asked what the style for the stdlib was |
18:30:01 | FromGitter | <dm1try> I like hist style guide^ |
18:36:42 | FromDiscord | <Shield> So I've found a way to release memory back to the system that should be useful for the sync file serving (and maybe async), creating a new thread to do the work will free the memory consumed by it without a problem, threadpool seem to not do that tho |
18:37:10 | FromDiscord | <Shield> now the question is, can you share a socket with a thread without breaking connection? |
18:39:46 | Araq | yes if you pass the raw socket handle |
18:40:18 | Araq | also called "file descriptor" |
18:42:49 | FromGitter | <xmonader> @Araq I'm considering applying for the nim position but I really need to know before wasting your time ⏎ ⏎ ```Does it mean it's okay not to be experienced with type theory, c, c++``` [https://gitter.im/nim-lang/Nim?at=5b9d52a9a56b215c974230b3] |
18:43:33 | FromDiscord | <Shield> is it safe to use with asyncdispatch? i'll be more than happy if somebody can help with it |
18:44:59 | Araq | xmonader: yeah, I can teach you everything anyway |
18:45:54 | FromGitter | <xmonader> @Araq awesome! Thanks |
18:49:06 | FromGitter | <tim-st> what? my database handle does work without `threadvar` now, maybe it only fails when the server is started in global scope (what the examples show) |
18:49:28 | FromGitter | <tim-st> in global scope there always were compiler errors |
18:58:33 | FromGitter | <tim-st> no, it fails for `string` too, but not for my type `ptr Environment`, is this a nim bug or why is string not gcsafe and my type is? |
19:00:24 | FromGitter | <tim-st> nims string is ptr too: https://github.com/nim-lang/Nim/blob/0e33a8676e325fa4174893291ed41d59b689c577/lib/system.nim#L444 that's weird |
19:03:19 | FromGitter | <dm1try> https://nim-lang.org/docs/manual.html#threads-gc-safety |
19:04:13 | FromGitter | <dm1try> gc-safety it is about procs and related vars that tracked by GC, `ptr` is not tracked by GC by design I think |
19:04:54 | FromGitter | <tim-st> @dm1try thanks, makes sense |
19:22:05 | FromGitter | <tim-st> when I press f5 in browser more ram is used with my httpserver, is it possible that many request fill ram complete or does the server reject request at some level or is it task of nginx? |
19:22:28 | FromGitter | <tim-st> I currently dont have ngix in front |
19:24:53 | FromGitter | <Bennyelg> It so sad aws sdk package is not working |
19:25:32 | FromGitter | <Bennyelg> most of the companies today are working using google or amazon and interaction with them is top priority |
19:28:58 | FromDiscord | <Shield> tim-st did you try the workaround I suggested? |
19:29:51 | FromGitter | <tim-st> Shield: no where have you posted it? |
19:32:25 | FromGitter | <dm1try> I bet the workaround is kinda complicated :) |
19:33:07 | FromDiscord | <Shield> about the thread, if there is a way to create a thread to handle the request, when it ends it is guaranteed to free the memory |
19:35:38 | FromGitter | <dm1try> you should be able go down through the layers to get the raw socket handle/unregister it from dispatcher maybe if it is needed/do your job in other thread and then go to the top =) |
19:36:09 | FromGitter | <dm1try> if you are using httpserver from stdlib |
19:36:27 | FromGitter | <dm1try> I might be wrong on this |
19:36:46 | FromGitter | <tim-st> Shield: I dont think that works, the main server is running on a thread that never ends and the memory is received there at first step afaik |
19:37:06 | FromGitter | <tim-st> at least that's what I imagine |
19:37:39 | FromGitter | <tim-st> I mean it would work for each single thread but still the main thread is there that grows ram |
19:39:44 | FromDiscord | <Shield> my point is, you encapsule the things that eat ram into its own thread and let it terminate when you're done with them, like when you send a file, you make the file reading and sending within the new thread |
19:42:04 | FromGitter | <tim-st> yes, I understood that, but I think that has to be done from the thread where the server runs so the memory has to be copied somehow I think, but as long as the memory can get limit to a max size, the huge memory shouldnt be a problem, I'm just not sure if it's possible to set a limit |
19:42:04 | FromDiscord | <Shield> so far it seems impossible to use nim to serve files, multiple fast requests leads to a constant growing in ram usage without reusing it, restarting the server every now and then doesn't seem like a good solution, using threads can work but i'm not sure |
19:43:42 | FromGitter | <tim-st> You are talking about windows only? I have to say I have not tested this memory growing under linux with a webbrowser |
19:44:40 | FromGitter | <tim-st> I have the same fear that once my system is finished the server needs to be restarted each x days :D |
19:45:20 | FromGitter | <tim-st> I hope we can see some statistics about nimforum |
19:47:29 | FromDiscord | <Shield> better make an example and ask somebody on linux to run it, i'm also in fear that my application will just crash the system |
19:48:05 | FromDiscord | <Shield> even a simple image server will keep eating ram for me... |
19:50:09 | FromGitter | <tim-st> I think the best is if we can get some nimforum statistics, it runs linux I think, and with asynchttpserver, I read that it needs to be restarted once a month or so, it would be good to hear the reasons |
19:54:38 | FromGitter | <dm1try> solutions from Ruby world: puma-killer, unicorn-killer, ...-killer, + heroku reloads yours dyno for you once a day =) |
19:55:05 | FromGitter | <tim-st> they do this really? |
19:56:50 | * | PrimHelios joined #nim |
19:56:53 | FromGitter | <dm1try> "Dynos are also restarted (cycled) at least once per day to help maintain the health of applications running on Heroku. " https://devcenter.heroku.com/articles/dynos |
19:59:36 | FromGitter | <tim-st> hm, maybe doing this once a day to a time where not much traffic is will solve the problem |
19:59:38 | * | krux02 joined #nim |
20:01:23 | FromGitter | <tim-st> is this tutoria enough? shouldnt it be needed to block incoming traffic on nim http server via iptables? https://github.com/nim-lang/nimforum/blob/master/setup.md |
20:01:54 | * | miran quit (Ping timeout: 244 seconds) |
20:05:43 | Araq | I've said it before. I can look into the leaks once you give me a program that is somewhat reasonable |
20:08:55 | FromGitter | <tim-st> ok, thanks, I will test it on linux better and try to find patterns before |
20:12:19 | Araq | and as I said it before, not sending the data with a fixed buffer size immediately creates a DoS attack vector |
20:13:52 | FromGitter | <tim-st> what does fixed buffer size mean? |
20:14:05 | FromGitter | <tim-st> is it the content-length? |
20:19:05 | FromGitter | <dm1try> deploy first, then we'll talk =) while testing some scripts uploaded here I found that `markAndSweep` gc has more predictable behaviour vs default gc in sense of allocation/deallocation(but it still on my list for the investigation) |
20:19:59 | FromGitter | <dm1try> obvious leaks were not found |
20:20:20 | FromGitter | <tim-st> yes, in worst case I will restart once a day |
20:23:27 | FromDiscord | <Shield> tim-st please keep me updated if you run it on linux |
20:24:01 | FromGitter | <tim-st> ok |
20:25:04 | FromGitter | <tim-st> I already tested a minimum example that didnt work good on windows, on linux the occupied memory was stable, but I think the total amount (allocated memory that is not used) is too high |
20:25:12 | * | Vladar quit (Remote host closed the connection) |
20:25:28 | FromGitter | <tim-st> but I will test it again maybe tomorrow |
20:31:53 | FromDiscord | <Shield> araq, i'm not sure what do you mean by a reasonable program, while reading large files to memory at once doesn't seem like a good idea, but it doesn't make sense to split an image file for example, it should be served whole, i think the question would be how fast can the gc reuse memory |
20:32:31 | * | tefter joined #nim |
20:32:41 | FromDiscord | <Shield> so far threads free their memory without problem but it's hard to use any current framework with that approach |
20:34:07 | * | kapil___ quit (Quit: Connection closed for inactivity) |
20:45:45 | * | SenasOzys quit (Remote host closed the connection) |
20:47:10 | * | SenasOzys joined #nim |
20:48:07 | * | akiman20 joined #nim |
20:50:50 | * | akiman20 quit (Remote host closed the connection) |
20:56:43 | FromDiscord | <Shield> I tried a minimal example with node.js serving a 10mb string, it works fine, only taking memory depending on the numbers of requests and free it when it's done sending |
20:57:29 | Araq | I tried a minimal Nim example serving 40mb files and got no leaks. Now what |
20:58:30 | Araq | and any approach that depends on Nim giving memory back to the OS seems flawed to me |
20:58:48 | Araq | you required the memory once, you might require it again |
21:01:29 | Araq | and yeah, even when serving images, you better stream anything larger than X MB. |
21:01:51 | Araq | especially if your "server" has a limited amount of RAM and swap disabled |
21:01:55 | ldlework | Nim programs releasing memory is a flaw. Hmm. |
21:02:38 | Araq | ldlework, polemic is not a substitute for an argument. Hmm. |
21:03:26 | ldlework | 1. a strong verbal or written attack on someone or something. |
21:03:28 | ldlework | erm |
21:03:39 | FromDiscord | <Shield> i think the problem is that the gc isn't reusing memory fast enough, it leads to each request allocating new memory, a server would be dealing with handreds of requests if not more, even serving a less than 1mb image would lead to massive ram usage |
21:04:19 | FromDiscord | <Shield> not freeing memory back to the os if fine as long as you provide a workaround that isn't "buy more ram lol" |
21:04:20 | Araq | ldlework, ok you win, I picked the wrong word. |
21:05:08 | TheLemonMan | what about "download more ram lol" ? |
21:05:44 | TheLemonMan | https://downloadmoreram.com/ is always there for your big data™ needs |
21:05:44 | shashlick | I appreciate the requirement @Shield but you need to provide a simple failing example |
21:07:00 | shashlick | If the gc isn't reusing memory that it should then that's something that can be pursued |
21:07:29 | FromDiscord | <Shield> shashlick you're free to use tim-st's snippet since the example shouldn't rely on any framework |
21:07:29 | FromDiscord | <Shield> https://gist.github.com/tim-st/abbb86a591172a7b997c853fcda5cff9 |
21:08:11 | * | smt joined #nim |
21:08:12 | Araq | that snippet uses 'sockets' which is deprecated and does not reproduce any leak for me |
21:08:28 | Araq | I'm asking for a better one |
21:10:04 | FromDiscord | <Shield> is asyncdispatch out of question too? |
21:10:22 | AlexMax | Hey shashlick! I made good progres last night, but ran into https://github.com/nim-lang/c2nim/issues/131 |
21:10:51 | Araq | "out of question"? no, you should use it. |
21:10:57 | AlexMax | I'm assuming I can just modify the config and add "struct" to the importc's...though that regex might be a little big :P |
21:11:27 | FromDiscord | <Shield> okay then |
21:44:49 | zestyr | Araq: is there a simple solution in the stdlib that lets you stream files instead of loading them into memory? |
21:45:04 | zestyr | httpclient's "post" doesn't support FutureStream |
21:46:08 | FromDiscord | <Shield> can browsers stream images for example? |
21:48:01 | zestyr | Shield: I managed to lower the memory overhead further btw, with a 50MB it now peaks at 100MB using markAndSweep, instead of around 300 MB. I can make a new gist if you want |
21:50:10 | shashlick | AlexMax: is that in many places |
21:50:46 | FromDiscord | <Shield> please do, i'm running some test now |
21:52:47 | zestyr | Alright. Same disclaimer as before, it's very ugly and probably shouldn't be used for anything serious, but without support for streaming files this is useful as a temporary hack |
21:52:49 | zestyr | https://gist.github.com/zestyr/22b187cab89e762cfd9ad3f90691cbb1 |
21:53:02 | AlexMax | shashlick: Only about 103 |
21:53:05 | AlexMax | :P |
21:53:34 | AlexMax | I was hoping I could maybe search on "header: headernuklear, bycopy" which appears to be used for all structs |
21:53:44 | AlexMax | But the line sometimes splits |
21:54:40 | AlexMax | and I'm not sure if that's 100% of structs |
21:55:49 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
21:58:44 | FromDiscord | <Shield> thanks zestyr |
21:59:19 | zestyr | note that this only works on linux, uses the posix module |
21:59:27 | AlexMax | So I think for now, the best appraoch is something like |
21:59:28 | AlexMax | regex.33 = "importc: \"(nk_(?:buffer|allocator))\"" |
21:59:28 | zestyr | could probably make it use readbuffer or whatever |
22:02:51 | FromDiscord | <Shield> this is just bizzare, converting tim-st example to asynsockets works fine, it does eat 110mb to send a 10mb file, but it's stable, sending 40mb file eats about 500mb |
22:04:27 | FromDiscord | <Shield> why did tim-st example cause the same problem as mofuw tho, using mofuw I tried to serve a webpage of about 800kb, it kept eating ram until it was about to fully saturate it before I stopped the program |
22:05:49 | * | nsf quit (Quit: WeeChat 2.2) |
22:09:03 | * | cyraxjoe quit (Quit: No Ping reply in 180 seconds.) |
22:09:26 | FromDiscord | <Shield> zestyr can you help me with a way to pass the socket between threads and let the thread handle the sending? if it can be done, then ram can be freed |
22:10:15 | * | cyraxjoe joined #nim |
22:11:39 | zestyr | Shield: have you tried using channels? I haven't played with sockets yet |
22:12:04 | dom96 | Shield: what's the use case? |
22:12:13 | * | Pisuke quit (Ping timeout: 246 seconds) |
22:12:31 | * | Sembei joined #nim |
22:15:07 | shashlick | @AlexMax: basically, every importc which has bycopy in the line should get replaced to "struckt nk*" |
22:16:43 | FromDiscord | <Shield> I wanna know the proper way to use a socket in a new thread once you pass the file descriptor |
22:17:35 | * | kapil___ joined #nim |
22:20:35 | FromDiscord | <Shield> the main thread will be some sort of a watcher, restarting the other thread and such, so far the server will take 10x the biggest file size and keep that memory even if such file no longer exists |
22:23:41 | dom96 | Shield: the proper way is don't use threads unless you have a use case that requires them |
22:25:00 | dom96 | Is there a reason why using async won't work? |
22:29:51 | FromDiscord | <Shield> it's more of "memory can't be freed once allocated" kind of issue |
22:31:30 | * | _brainbomb_ joined #nim |
22:34:49 | dom96 | Let's fix the leaks instead of working around them by messing with threads |
22:38:09 | * | _brainbomb_ quit (Quit: Leaving.) |
22:39:46 | * | cyraxjoe quit (Read error: Connection timed out) |
22:39:50 | FromDiscord | <Shield> well it's not a leak, serving a big file once will lead to keeping that memory thinking it may be used again when there's a high chance it won't |
22:41:01 | * | cyraxjoe joined #nim |
22:41:40 | FromDiscord | <Shield> by the way, using GC_fullCollect right after sending the file will lead to a stable 277mb instead of 530mb for a 40mb file |
22:42:26 | FromDiscord | <Shield> it won't be that bad for an image server at least |
22:43:01 | dom96 | That sound excessive, we need to fix that. |
22:43:16 | dom96 | If it happens when a file is served it sounds like the reproduction is easy |
22:43:20 | dom96 | Why not report it? |
22:49:01 | FromDiscord | <Shield> well this is a minimal example https://pastebin.com/FEQ6RwVT |
22:50:48 | FromDiscord | <Shield> it may be the "&" operator making more copies tho, and as Araq said, once the memory is requested from the os it's hard to give it back |
22:54:31 | dom96 | I'll chat with Araq about it |
22:54:33 | dom96 | good night |
22:58:33 | FromDiscord | <Shield> good night |
23:07:48 | * | arecaceae quit (Remote host closed the connection) |
23:08:07 | * | arecaceae joined #nim |
23:09:50 | * | rockcavera quit (Remote host closed the connection) |
23:12:05 | * | elrood quit (Quit: Leaving) |
23:14:06 | FromGitter | <DanielSokil> Why does this throw a ValueError? ⏎ ⏎ ```{ ⏎ "Antelope (Blackbuck)": { ⏎ "LifeSpan": "15" ⏎ } ⏎ }``` [https://gitter.im/nim-lang/Nim?at=5b9d923e3b7e6c2edd21f073] |
23:23:35 | FromGitter | <Vindaar> @DanielSokil because of the extra `"` around the 15 |
23:24:43 | FromGitter | <Vindaar> during parsing of the json it is therefore not parsed as a `JInt`, but a `JString`. So when converting back to a string it still has those `"` around it. And that's not allowed for `parseInt` |
23:30:37 | FromGitter | <Vindaar> It's a little subtle, because the `$` operator for json doesn't retrieve the contained string in the `JsonNode`, but rather converts it to a string representation |
23:31:04 | FromGitter | <Vindaar> If you can be sure it's always going to be strings, you can replace the `$` call by a call to `getStr`, then the conversion won't have those `"` around |
23:31:44 | FromGitter | <Vindaar> (by conversion to string representation I mean as a JSON like string) |
23:36:39 | AlexMax | Man |
23:36:43 | AlexMax | Got through all that regex |
23:36:47 | FromGitter | <DanielSokil> @Vindaar That's what I was looking for, Thank you. |
23:36:59 | AlexMax | Now gcc is dying on something that I am totally baffled by |
23:37:03 | AlexMax | Some internal thing |
23:38:02 | * | cspar quit (Quit: Leaving) |
23:40:42 | AlexMax | https://paste.ee/p/XZ5pA |
23:46:26 | AlexMax | oh god I am totally lost |