00:03:39 | FromGitter | <alehander42> ok |
00:03:40 | FromGitter | <alehander42> sorry |
00:03:47 | FromGitter | <alehander42> in this case you can put `()` around the case |
00:03:50 | FromGitter | <alehander42> and it works |
00:03:55 | FromDiscord | <Nat> no worries, I appreciate the help! |
00:04:22 | FromGitter | <alehander42> around the whole case multiline |
00:05:34 | FromGitter | <alehander42> another variant is to use `do ` as mratsim suggests, but then you need `()` around the whole toSeq expr |
00:05:48 | FromGitter | <alehander42> and `do` might be deprecated in the future |
00:06:37 | FromGitter | <alehander42> also you need to import sugar |
00:06:49 | FromGitter | <alehander42> because `=>` is a helper defined there |
00:06:53 | FromGitter | <alehander42> (syntax sugar module) |
00:07:01 | FromDiscord | <Nat> Not sure I understand the wrapping the case statement, it seems like something like https://gist.github.com/natdempk/31fc44cb3c195cf015113f2bb859be5f doesn't work |
00:07:11 | FromDiscord | <Nat> ah |
00:07:16 | FromDiscord | <Nat> it was the import sugar, thanks! |
00:08:14 | FromDiscord | <Nat> thanks for the help 🙂 |
00:08:30 | FromGitter | <alehander42> no problem |
00:08:53 | FromDiscord | <Nat> slowly working through the exercism nim stuff |
00:09:41 | FromGitter | <alehander42> if you are interested in using it for bio stuff, you can always take a peek at https://github.com/brentp (many bio-related nim ) |
00:09:48 | FromGitter | <alehander42> ah, if its exercises, great |
00:10:07 | FromDiscord | <Nat> yeah just basic coding exercises to learn the language |
00:10:14 | FromGitter | <alehander42> ook |
00:10:19 | FromDiscord | <Nat> not serious bio stuff 😛 |
00:17:09 | * | couven92 quit (Quit: Client Disconnecting) |
00:32:15 | FromGitter | <Willyboar> @federico3 are you here? |
00:34:32 | FromGitter | <Willyboar> @VPashkov are you abandon awesome_nim? |
00:42:49 | federico3 | not much :) |
00:44:57 | * | nixfreak quit (Ping timeout: 240 seconds) |
00:46:11 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
00:46:17 | * | krux02_ joined #nim |
00:49:03 | * | krux02 quit (Ping timeout: 245 seconds) |
01:29:34 | * | krux02_ quit (Remote host closed the connection) |
01:38:50 | * | lritter quit (Quit: Leaving) |
01:45:19 | * | Jjp137 quit (Ping timeout: 268 seconds) |
01:47:25 | * | Jjp137 joined #nim |
02:10:57 | FromDiscord | <LinuxTerm> hi |
02:14:04 | FromDiscord | <Rika> hello |
02:42:21 | rayman22201 | anybody online that knows how to get -d:nimTracing to work? |
02:43:10 | disruptek | what is it? |
02:44:34 | rayman22201 | extra debugging in the garbage collector code |
02:45:02 | rayman22201 | I think only Araq really knows but my timezone is wrong :/ |
02:45:18 | disruptek | i've done some gc debugging but i'm not very familiar with it, and i don't believe i've used nimTracing. |
02:46:25 | disruptek | grep says it's there but you need hasThreadSupport. |
02:47:28 | rayman22201 | hrmmm. I will try it |
02:47:37 | rayman22201 | apparently I don't grep as well as you lol |
02:47:56 | disruptek | well, it's under the when at L29 in gc_ms.nim. |
02:48:12 | disruptek | sorry, that's wrong. i'm dumb. |
02:48:18 | * | nif quit (Quit: ...) |
02:48:28 | * | nif joined #nim |
02:48:34 | disruptek | couldn't read my screen. 😁 |
02:48:37 | rayman22201 | wait, wat lol |
02:48:39 | rayman22201 | ok then |
02:48:54 | disruptek | but still, it's clear that it's used in there. |
02:49:06 | disruptek | just, y'know, doesn't seem that you need hasThreadSupport. |
02:49:30 | rayman22201 | I don't want to turn on threads unless I need to, since I'm debugging the GC, and threads just make everything more complicated |
02:49:31 | leorize | gcTracing probably only works with --gc:markandsweep |
02:49:37 | rayman22201 | that is correct |
02:49:42 | rayman22201 | and I am using markandsweep |
02:49:52 | rayman22201 | but I am not using threads |
02:50:27 | disruptek | i think it's working. |
02:50:43 | rayman22201 | what is lol? |
02:52:21 | disruptek | /home/adavidoff/git/Nim/lib/system/gc_ms.nim(370, 48) Error: undeclared identifier: 'stdout' |
02:52:32 | rayman22201 | that's the error I get. congrats lol |
02:52:46 | disruptek | so open a file somewhere. |
02:53:19 | rayman22201 | solve any problem. just open a file somewhere :-P |
02:53:22 | disruptek | gotta reorder things so you have io. |
02:54:02 | rayman22201 | it's ok. I have other ways to get what I need. I just thought I would ask if anybody had the easy way working |
02:54:15 | rayman22201 | the point is not to rewrite my own debugging code if some is already there |
02:54:32 | disruptek | yeah, i was surprised stdmsg() didn't work. |
02:55:44 | * | leorize quit (Ping timeout: 260 seconds) |
02:58:51 | disruptek | i don't think this has been used in a long time. |
02:59:20 | rayman22201 | yeah :/ |
02:59:22 | rayman22201 | oh well |
02:59:46 | disruptek | jan of last year isn't that long ago i guess. |
03:00:10 | * | leorize joined #nim |
03:00:55 | leorize | it's probably was broken by the io.nim split |
03:01:08 | rayman22201 | ahhh. that makes sense |
03:01:40 | rayman22201 | good news. I think I made good progress on fixing async so it works with araqgc now. Bad news, I think I found a boehm bug :-/ |
03:02:03 | leorize | you made it work with araqgc? |
03:02:10 | disruptek | if it's a bug in boehm, that's pretty great news. |
03:02:14 | rayman22201 | modulo bugs :-P |
03:02:16 | leorize | I guess --gc:destructors is gonna be the next gc :p |
03:02:26 | leorize | --newruntime failed :P |
03:03:39 | rayman22201 | It could be a bug in my fix, but if I insert an `await sleepAsync(1)` in the test, it suddenly works. |
03:03:55 | rayman22201 | This makes me think it's a boehm bug, and not a bug in my async impl. |
03:04:40 | rayman22201 | but I think I need Araq super powers to figure out in more detail what is happening |
03:06:05 | rayman22201 | Thanks peeps. bbl |
03:15:27 | * | GordonBGood joined #nim |
03:34:10 | disruptek | if there's one thing i cannot abide, it's tornados. |
03:42:51 | * | disruptek quit (Ping timeout: 252 seconds) |
03:43:06 | * | snooptek quit (Ping timeout: 268 seconds) |
03:49:51 | * | jwm224 quit (Ping timeout: 264 seconds) |
03:55:36 | yumaikas | https://github.com/yumaikas/comic-trakr tiny website in Jester I just made, if anyone is interested |
04:03:39 | * | oscar1 joined #nim |
04:04:58 | * | dchem joined #nim |
04:06:03 | dchem | hi everyone |
04:18:40 | leorize | o/ |
04:20:22 | * | dchem quit (Quit: WeeChat 2.4) |
04:20:49 | yumaikas | leorize: you read webcomics much? |
04:23:04 | * | abm quit (Quit: Leaving) |
04:23:43 | leorize | no :P |
04:24:42 | * | oscar1 quit (Quit: WeeChat 2.4) |
04:25:35 | skrylar[m] | hastyscribe looks a lot like multimarkdown 😉 |
04:29:15 | * | rockcavera quit (Remote host closed the connection) |
04:37:26 | * | nsf joined #nim |
04:51:03 | * | dchem joined #nim |
04:59:50 | * | chemist69 quit (Ping timeout: 276 seconds) |
05:01:13 | * | chemist69 joined #nim |
05:10:39 | * | dchem quit (Quit: WeeChat 2.4) |
05:49:22 | * | dchem joined #nim |
06:29:42 | * | Trustable joined #nim |
06:33:13 | * | lj00nal joined #nim |
06:34:33 | * | MightyJoe quit (Ping timeout: 265 seconds) |
06:35:05 | * | cyraxjoe joined #nim |
06:35:38 | * | ljoonal quit (Ping timeout: 240 seconds) |
06:38:33 | Araq | rayman22201: so what did you find out? |
06:46:13 | * | zombiefisch is now known as qwertfisch |
06:52:59 | * | kevin_ joined #nim |
06:53:31 | * | narimiran joined #nim |
07:00:00 | * | gmpreussner_ quit (Quit: kthxbye) |
07:04:53 | * | gmpreussner joined #nim |
07:08:28 | * | dchem quit (Quit: WeeChat 2.4) |
07:17:02 | GordonBGood | Araq, can you or anyone help me understand why TestObj captured in a temporty closure isn't showing as testroyed? - https://gist.github.com/GordonBGood/9971e9ccca6ecef010f925f3d057e701 |
07:17:43 | GordonBGood | Doesn't seem to matter what GC used, so not really related to ref counting... |
07:17:58 | GordonBGood | Just me investigating closure environments |
07:18:15 | GordonBGood | ^ temporary closure |
07:20:00 | GordonBGood | Outside closures, ref's internal to proc's get destroyed as expected, whether elements of seq's, fields of objects/tuples, etc. |
07:21:16 | GordonBGood | I understood that closure environments are ref's, thus the investigation... |
07:21:56 | GordonBGood | Or are closure environments ptr's and somehow the automatic destruction isn't being triggered? |
07:24:32 | GordonBGood | Araq, also trying to generate a MCVE of the "nested closure" problem with my test program from yesterday that is a problem to do with --gc:destructors/ref counting, but... |
07:24:54 | GordonBGood | So far I haven't come up with anything simpler than that "hammings" test program |
07:25:36 | * | PMunch joined #nim |
07:28:15 | * | theelous3 quit (Ping timeout: 264 seconds) |
07:36:37 | * | theelous3 joined #nim |
07:40:11 | * | solitudesf joined #nim |
07:45:57 | * | ftsf joined #nim |
07:51:33 | PMunch | Hmm, seems like rebuilding the playground images didn't go as planned |
07:52:24 | PMunch | play.nim-lang.org/versions replies with {"versions":["Segmentation fault"]} |
07:52:56 | ftsf | hmm is it expected that certain procs won't show up in a stacktrace on error? I'm getting an AssertionError when calling del on a seq, but the proc that calls del doesn't show up in the stacktrace, nor does del. (iterators delete does though) |
07:59:47 | Araq | ftsf: templates have no stack entry due to their inlining semantics |
07:59:54 | Araq | but procs are usually not missing |
08:00:19 | FromDiscord | <Lantos> @shashlick nimgraphql seems to be creating a empty folder in any nimible projects even if it dosen't have nimgraphql |
08:00:24 | ftsf | hmm, definitely procs in this instance, i'll try narrow down the case and file an issue |
08:01:50 | FromDiscord | <Lantos> @benjikun I was able to run the tests in nimetry but can not import it in other projects. I have run nimble install nimetry and also using cpp backend |
08:03:54 | * | gmpreussner_ joined #nim |
08:04:27 | * | gmpreussner quit (Ping timeout: 265 seconds) |
08:06:13 | * | kungtotte joined #nim |
08:06:19 | GordonBGood | Araq: Got it, a MCVE showing the nested closure problem with --gc:destructors/ref counting - https://gist.github.com/GordonBGood/705a1faa51eabb72514b6b976d5dc47d |
08:09:18 | * | nif quit (Quit: ...) |
08:09:29 | * | nif_ joined #nim |
08:10:29 | FromDiscord | <Lantos> I think it might have to do with my nimble pkg dir setup |
08:14:30 | GordonBGood | Araq: on investigating the proc `symToClosure` with my comments after you left last night starting at - https://irclogs.nim-lang.org/31-10-2019.html#19:41:48 |
08:15:47 | GordonBGood | Araq: I'm running the MCVE gist on devel of two days ago, as yesterdays commits seem to be unreleated |
08:18:58 | ftsf | @Araq, aha, it is showing in the stacktrace, but with the wrong filename https://gist.github.com/ftsf/4e354e33e43d697d659c62fee781212c (bar says it's in iterators.nim, not nimseqdel.nim) or am I misreading the stacktrace? |
08:23:38 | * | dddddd quit (Remote host closed the connection) |
08:28:56 | Araq | ftsf: it is nothing new, hard to fix/improve |
08:29:21 | Araq | GordonBGood: I wrapped your top level statements in a 'main' proc |
08:29:24 | Araq | then I did: |
08:29:30 | ftsf | Araq, okay |
08:29:31 | Araq | const toDebug = "main" |
08:29:39 | Araq | in injectdestructors.nim |
08:29:43 | Araq | and ran: |
08:29:57 | Araq | koch temp c --gc:destructors -r temp.nim |
08:30:07 | Araq | and it doesn't inject destructors, that's why :P |
08:32:15 | Araq | some logic needs to be adapted |
08:32:36 | Araq | canBeMoved() is also suboptimal for --gc:destructors |
08:35:23 | * | kevin_ quit (Ping timeout: 265 seconds) |
08:37:42 | FromDiscord | <Lantos> cant find it whats the best way to turn "30" to 30'f32 |
08:37:44 | FromDiscord | <Lantos> cant find it whats the best way to turn "30" to 30'f32? |
08:37:58 | FromGitter | <alehander42> parseFloat + float32 |
08:38:05 | FromGitter | <alehander42> ? |
08:38:16 | FromDiscord | <Lantos> tried cast[float](string) no work |
08:38:36 | FromGitter | <alehander42> well, cast works only when the memory representation would be valid for both types |
08:38:44 | FromGitter | <alehander42> a string "30" looks very different to a float |
08:38:52 | FromGitter | <alehander42> you need to use a parsing function |
08:39:04 | FromGitter | <alehander42> from strutils |
08:39:18 | FromDiscord | <Lantos> float(int) -> float works fine |
08:39:18 | FromDiscord | <Lantos> float(str) -> ~~~~ |
08:39:32 | FromGitter | <alehander42> ok, please read my suggestion |
08:40:17 | FromGitter | <alehander42> sorry |
08:40:31 | FromGitter | <alehander42> i understand: you expect the python behavior |
08:40:41 | FromDiscord | <Rika> lantos are you having internet issues perhaps? |
08:40:44 | FromGitter | <alehander42> here `(type)(value)` is something different: its a type conversion |
08:41:11 | FromDiscord | <Lantos> import strutils |
08:41:11 | FromDiscord | <Lantos> parseFloat() |
08:42:33 | FromGitter | <alehander42> yes |
08:42:54 | PMunch | Lantos: https://play.nim-lang.org/#ix=20tr |
08:42:56 | FromGitter | <alehander42> honestly this is a good question: i cant fully explain what is the big difference between type conversions and the `parse` family |
08:43:08 | FromGitter | <alehander42> and why e.g. `float()` works for int, not for string |
08:43:29 | PMunch | Well, int->float will always work, string->float not so much |
08:43:32 | FromGitter | <alehander42> it makes sense to me as a simpler operation but not sure about the rationale |
08:43:54 | FromGitter | <alehander42> well, not sure: e.g. you can write int(floatvalue) iirc |
08:44:11 | FromGitter | <alehander42> and if you write int16(float64value) |
08:44:23 | FromGitter | <alehander42> i guess it works in a sense, but hm |
08:44:25 | PMunch | Parse is about taking something and reading some information out of it. Type conversions just change things between representations (potentially lossy) |
08:44:42 | FromDiscord | <Lantos> best way to handle errors on this? |
08:44:55 | FromDiscord | <Lantos> https://play.nim-lang.org/#ix=20ts |
08:45:18 | PMunch | Lantos, depends on where you are using it.. |
08:45:32 | FromGitter | <alehander42> good question |
08:45:40 | FromDiscord | <Lantos> uhhh to default to 0 |
08:45:46 | FromGitter | <alehander42> people often dont think that similar primitives can fail |
08:45:55 | FromDiscord | <Lantos> like js short circuit |
08:46:27 | FromDiscord | <Lantos> var s = parseFloat("") || 0; |
08:47:04 | FromGitter | <alehander42> hm, well honestly you would need to define your own wrapper for that |
08:47:22 | PMunch | https://play.nim-lang.org/#ix=20tt |
08:47:50 | FromDiscord | <Lantos> thanks punch man 🙂 |
08:48:05 | FromGitter | <alehander42> : hehe |
08:48:21 | PMunch | Or if you want to use `||`: https://play.nim-lang.org/#ix=20tu |
08:48:26 | * | kevin joined #nim |
08:48:46 | PMunch | Nice side-effect of Nim returning the last value in a block if it makes sense :) |
08:48:49 | * | kevin is now known as Guest47739 |
08:49:30 | PMunch | Same reason ternaries in Nim are just regular if statements |
08:50:41 | PMunch | I tend to abuse that quite a bit, assigning things with `let` through an if statement instead of defining a `var` and then have an if statement that assign it. |
08:55:32 | PMunch | Example of the benefits of using let and ternaries: https://play.nim-lang.org/#ix=20tw |
08:56:34 | PMunch | Or not ternaries, but rather the implicit return from if blocks :) |
08:56:59 | PMunch | This of course also works for case statements, and try blocks as you saw earlier |
08:59:53 | PMunch | And `block` statements for that matter, so you can create temporary variables that doesn't stick around: https://play.nim-lang.org/#ix=20ty |
09:04:59 | GordonBGood | Araq: does "and it doesn't inject destructors" refer to my first question on why closure environments arn't destroyed? |
09:05:22 | Araq | yes, but looking further at it, it seems correct |
09:05:46 | Araq | you don't capture anything let clsr = () => (...) |
09:05:55 | GordonBGood | For that one, I can't get TestObj to show it being destroyed with run with default GC either |
09:06:45 | Araq | moving TestObj containing from/to: 42 0 |
09:06:45 | Araq | destroying TestObj containing: 0 |
09:06:53 | Araq | it does destroy it. |
09:06:57 | GordonBGood | That clsr doesn't capture, but the "tst" value inside the body is a closure that has captured "c", a TestObj |
09:07:38 | Araq | well it's destroyed too early |
09:07:55 | GordonBGood | That's when the TestObj is moved into the closure and destroys the default zero it replaces |
09:08:02 | * | Vladar joined #nim |
09:08:39 | Araq | gosh write tests that are not convoluted messes please |
09:09:52 | GordonBGood | First it is created as a temp containing 42, then that is copied into the closure, destroying the 0 that was there; there are no other destructions ever |
09:10:37 | GordonBGood | I tried to make it simpler; but couldn't come up with a way to show when closure environments are destroyed... |
09:11:49 | GordonBGood | the reason for the global clsr is that global values don't get destroyed; I should have just wrapped it all in a maiin and called that as you have done |
09:12:13 | GordonBGood | You can then eliminate the indirection of the extra outer clsr |
09:13:19 | Araq | var tst |
09:13:19 | Araq | try: |
09:13:19 | Araq | `=sink`(tst, makeInnerClosure()) |
09:13:21 | Araq | write(stdout, "as obtained: ") |
09:13:23 | Araq | tst() |
09:13:25 | Araq | finally: |
09:13:27 | Araq | `=destroy`(tst) |
09:13:31 | GordonBGood | I made the `=destroy` and `=sink` hooks so I could tell when TestObj was being destroyed and why (the only time is the result of the move) |
09:13:53 | Araq | so it kinda works but the =destroy for 'tst' is likely wrong or empty |
09:21:39 | GordonBGood | Araq: tried it your way inside a main() with var tst: () -> void - still don't see any extra destructor messages, and it's not to do with --gc:destructors, I ran default |
09:22:18 | GordonBGood | the only destrution is as a result of the `=sink` |
09:22:59 | GordonBGood | I tried an explicit call to `=destroy` before with no difference just as here |
09:31:14 | GordonBGood | Araq: it seems to me there is a severe memory leak to do with closure environments, and it's not limited to --gc:destructors... |
09:32:28 | GordonBGood | I changed TestObj to include a "big" field of a million int's, chaned to printing to only print cntnts, even added a GC_fullCollect in the finally, then... |
09:33:21 | GordonBGood | took the difference in getOccupiedMem between the beginning and end of mem and the difference is 8 million bytes (64-bit compile) |
09:35:08 | Araq | run it in a loop and watch its stable memory usage |
09:35:09 | GordonBGood | The added "big" field of TestObj is an array[1024*1024, int] |
09:35:41 | GordonBGood | Okay, just a mo |
09:40:06 | Araq | the bugs we're hunting are all new, the old stuff works |
09:42:43 | GordonBGood | You're right, with the default GC, memory usage goes up 8 meg and doesn't continue up for repeated loops; the only question there is when the actual destruction is being done and why aren't we seeing the messages |
09:43:49 | GordonBGood | When I run the same looping program with --gc:destructors, it crashes after the first loop with "[FATAL] unpaired dealloc", which should give some clues |
09:47:38 | FromDiscord | <Lantos> An attempt at templates mpunch |
09:47:38 | FromDiscord | <Lantos> https://play.nim-lang.org/#ix=20tI |
09:48:41 | FromDiscord | <Rika> @Lantos convert x into a bool, somehow |
09:48:49 | FromDiscord | <Rika> nim doesnt have truthiness |
09:49:02 | FromDiscord | <Rika> (i think it doesnt...) |
09:51:14 | GordonBGood | Araq: now I don't even need a loop to get the "[FATAL] unpaired dealloc" error, it is generated by the finally call to `=destroy` |
09:53:27 | FromDiscord | <Rika> ok lantos disregard what i said, i misread the error |
09:54:01 | PMunch | Lantos, sorry you didn't ping me correctly so I didn't see this until now: https://play.nim-lang.org/#ix=20tK |
09:54:42 | PMunch | The error is a bit odd, but essentially the if block can't return anything if it doesn't have an else part. Otherwise it wouldn't be guaranteed to return anything |
09:54:57 | GordonBGood | Araq: so I eliminated the finally call to `=destroy` and ran the loop and memory use stabalizes at 72 bytes - there are just two things... |
09:55:40 | PMunch | This might be a more generic solution: https://play.nim-lang.org/#ix=20tM |
09:56:16 | GordonBGood | Just as for the default GC, why don't we see destruction messages for TestObj (if it isn't being destroyed and contained pointers to the heap, that would cause memory leaks), and... |
09:56:23 | PMunch | Essentially that default(typeof(y)) will return the default value of the type of y if the check fails. So 0 for numbers, and an empty string or seq for those. |
09:57:07 | PMunch | Of course in this case I guess you might've wanted a raise statement there instead |
09:57:11 | GordonBGood | if the closure environment has already beed deallocated, why is it not also nil'ed so that it can't be done again by `=destroy`? |
09:57:20 | * | gmpreussner joined #nim |
09:58:02 | * | gmpreussner_ quit (Ping timeout: 265 seconds) |
09:59:48 | PMunch | Lantos: something like this: https://play.nim-lang.org/#ix=20tN |
10:04:18 | GordonBGood | Araq: it seems to me that there is a memory leak for closures that has been lurking... |
10:05:10 | GordonBGood | Whoops, maybe not, just let me check again |
10:08:33 | GordonBGood | Nope, it seems the leak is real: I changed the "big" field to an allocation of a megabyte per TestObj, and deallocated the pointer when not nil as part of the `=destroy`... |
10:09:15 | GordonBGood | The closure environment is being deallocated, but it's not calling through the the environment contents destructors... |
10:09:54 | FromDiscord | <Lantos> Lol I am actually so surprised how well and readable that is @PMunch even when reading from my phone. |
10:09:54 | FromDiscord | <Lantos> |
10:09:54 | FromDiscord | <Lantos> How is nim not used more then it is? |
10:10:17 | GordonBGood | So memory use increases by a megabyte per loop for GC or --gc:destructors |
10:12:02 | * | ZORR0W joined #nim |
10:12:25 | * | ZORR0W quit (Client Quit) |
10:16:26 | GordonBGood | Araq: for both --gc:refc and --gc:destructors, resource monitor agrees that memory use continually increase by a megabyte per loop over the duration of the run, after which if drops back to normal |
10:18:03 | GordonBGood | It seems to me that the problem is that the calls to the environment contents destructors is not being injected before the closure environment is deallocated, leaving the potential for a leak |
10:18:49 | PMunch | Lantos, beats me. Nim is a great language :) |
10:20:53 | FromDiscord | <Rika> @Lantos lack of endorsement |
10:21:04 | FromDiscord | <Rika> Also no major company sponsor I guess? |
10:21:19 | FromDiscord | <Rika> Rust has Mozilla, golang has Google |
10:21:36 | FromDiscord | <Rika> No company comes to mind for Nim |
10:21:48 | FromDiscord | <Rika> That might be a factor |
10:22:10 | FromDiscord | <Chiqqum_Ngbata> Some things are just too cool for school |
10:24:47 | * | disruptek joined #nim |
10:35:16 | GordonBGood | Araq, this problem has been lurking since forever, but isn't a problem for normal use, as the GC takes care of ref's eventually, and there was special logic for legacy strings and seq's to make them treated as ref's... |
10:36:41 | GordonBGood | Also, before destructors, if an inner field wan't a ref's programmers would ahve used the finalizer to take care of it when it was GC'ed... |
10:37:08 | GordonBGood | However, now that we want/need to depend on destructors, the bug pops into play |
10:38:11 | FromDiscord | <Lantos> A magor sponsor is important. From someone from the outside. It looks like a project that is the hobby of a lot of really smart guys. At the same time v is fairly new but has a lot of movement behind it |
10:38:38 | FromDiscord | <Lantos> A major sponsor is important. From someone from the outside. It looks like a project that is the hobby of a lot of really smart guys. At the same time v is fairly new but has a lot of movement behind it |
10:39:21 | * | clyybber joined #nim |
10:39:55 | PMunch | Oh, by the way Lantos, whenever you edit a message on Discord the entire thing is resent to IRC.. |
10:40:23 | FromDiscord | <Lantos> Oh okay will, double check my post before sending 👍 |
10:40:33 | PMunch | Does V really have a lot of movement behind it? It got a lot of hype, but I haven't heard of anyone actually using it |
10:41:40 | FromDiscord | <Lantos> Yeah I guess, more so hype. Id like to see it reach 1.0 |
10:48:33 | * | jjido joined #nim |
10:54:35 | * | thomasross quit (Ping timeout: 265 seconds) |
11:05:13 | * | narimiran quit (Ping timeout: 265 seconds) |
11:22:55 | FromGitter | <alehander42> i dont know, i think the sponsor thing is a bit overrated sometimes |
11:23:02 | clyybber | yeah |
11:23:28 | FromGitter | <alehander42> i'd prefer a multitude of smaller companies/people helping |
11:23:38 | FromGitter | <alehander42> similarly to languages like python/ruby etc |
11:23:49 | FromGitter | <alehander42> (ok, they also have big sponsors, but not a main one) |
11:23:53 | PMunch | Definitiely, but I think having one big company shows other companies that it is worth trying |
11:24:11 | PMunch | So it's easier to get quick adoption |
11:24:39 | PMunch | Python really is the odd man out in the programming language game, it just sorta got popular over time. Without any large bump |
11:25:07 | clyybber | I prefer a language thats loved by the people over one thats loved by managers |
11:25:34 | PMunch | Oh course, but it doesn't help that it's being loved by programmers if they aren't allowed to use it |
11:26:10 | clyybber | PMunch: In the case of python its so simple so they use it in their free-time and eventually it will spill into the work environment |
11:26:49 | * | Guest47739 quit (Remote host closed the connection) |
11:26:50 | * | solitudesf quit (Ping timeout: 268 seconds) |
11:27:41 | PMunch | Yeah, Python just sorta got popular because people used it a lot. And I can see something similar happening for Nim |
11:27:49 | clyybber | disruptek: why did you leave offtopic :( |
11:27:49 | * | Vladar quit (Quit: Leaving) |
11:28:17 | PMunch | When I started this job I actually found a guy who used Nim a bit, and was experimenting with using it for work stuff as well :) |
11:28:30 | clyybber | Huh, cool :D |
11:29:01 | FromDiscord | <Rika> `No variable shadowing` woah V sounds monakshake |
11:30:14 | clyybber | wth is monakshake? |
11:30:34 | FromDiscord | <Rika> sorry just some dumb emote i got a habit of using |
11:30:44 | clyybber | :monakshake: |
11:30:49 | PMunch | Yeah I was a bit surprised actually. And it was sorta the perfect use case, he was writing installers, and the language the installer framework used was Pascal-script (which is just a horrible version of Pascal). But it also offered the possibility to load and use DLLs, so he was looking for a language to replace C for creating DLLs. Just to implement some simple logic stuff and system calls to not have to use Pascal-script. |
11:31:25 | PMunch | Unfortunately creating DLLs isn't all that trivial.. Maybe that should be my next article |
11:33:15 | * | theelous3 quit (Ping timeout: 265 seconds) |
11:51:02 | * | chemist69 quit (Quit: WeeChat 2.6) |
11:54:52 | FromDiscord | <mratsim> and the next one after DLL should be hot code reloading 😉 |
11:56:09 | FromDiscord | <Lantos> I see that v doesn't have macros but after using the template it makes me wond why no macros |
11:57:22 | * | clyybber quit (Quit: WeeChat 2.6) |
11:58:17 | FromDiscord | <mratsim> @Araq I'm confused by the pure refcounting gc for gc:destructors, where does the Bacon goes then? or will the refcounting GC turned into Bacon once it's ready? |
11:59:54 | FromGitter | <kaushalmodi> Hello all |
12:00:13 | FromGitter | <kaushalmodi> Just came by to say thanks once again for this aweso |
12:00:21 | FromGitter | <kaushalmodi> *awesome language |
12:02:27 | PMunch | Hi kaushalmodi, what're you up to? |
12:02:32 | FromDiscord | <mratsim> @Lantos Nim will be sponsored by Oracle soon: https://forum.nim-lang.org/t/5438 |
12:02:53 | FromDiscord | <Rika> OOOH |
12:03:06 | FromDiscord | <Rika> baited :/ |
12:03:18 | FromGitter | <kaushalmodi> PMunch: Just too busy with work |
12:04:06 | FromGitter | <kaushalmodi> But still playing with Nim.. I occasionally git pull to the latest and keep on using it. No breaking issues so far, which is nice. |
12:04:24 | FromDiscord | <mratsim> still using for SystemVerilog interop? |
12:04:24 | * | chemist69 joined #nim |
12:04:34 | FromGitter | <kaushalmodi> Everyday! |
12:04:48 | * | rockcavera joined #nim |
12:04:55 | FromGitter | <kaushalmodi> It's heart of the test bench that I've set up |
12:05:01 | FromDiscord | <mratsim> nice 🙂 |
12:05:25 | FromGitter | <kaushalmodi> Now there's me and one more Nim coder at work |
12:06:10 | FromDiscord | <mratsim> spreading the word I see 🙂 |
12:06:36 | FromGitter | <kaushalmodi> Just yesterday I was playing with plotting of data sent over to Nim from SV: https://github.com/kaushalmodi/nim-systemverilog-dpic/blob/master/plot/README.org |
12:07:23 | * | krux02 joined #nim |
12:17:07 | PMunch | Oh cool, so I'm not the only one who tries to sneak Nim in at work :P |
12:19:50 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:22:28 | FromDiscord | <Lantos> hahaha the baits |
12:23:26 | * | nsf quit (Quit: WeeChat 2.6) |
12:24:28 | FromDiscord | <Lantos> I'm going to try sneak nim in |
12:24:41 | FromDiscord | <Lantos> Some other dev is trying to sneak moonscript in |
12:26:19 | FromDiscord | <Rika> moonscript >_> |
12:31:42 | * | thomasross joined #nim |
12:35:08 | FromDiscord | <Lantos> ``` |
12:35:08 | FromDiscord | <Lantos> hello = (name) => (print name) |
12:35:08 | FromDiscord | <Lantos> hello("meme") |
12:35:08 | FromDiscord | <Lantos> ``` |
12:35:08 | FromDiscord | <Lantos> ``` |
12:35:09 | FromDiscord | <Lantos> local hello |
12:35:09 | FromDiscord | <Lantos> hello = function(self, name) |
12:35:09 | FromDiscord | <Lantos> return (print(name)) |
12:35:10 | FromDiscord | <Lantos> end |
12:35:12 | FromDiscord | <Lantos> return hello("meme") |
12:35:12 | FromDiscord | <Lantos> ``` |
12:40:17 | PMunch | Again, plase don't paste directly.. |
12:41:03 | PMunch | Hmm, I have a curious bug. The .so build works flawless. But when I cross compile to Windows it does something weird |
12:41:36 | FromGitter | <alehander42> https://github.com/nim-lang/packages/pull/1233 |
12:41:42 | PMunch | I change the value through a pointer, but when I try to access that value in the calling code it is still 0.. |
12:41:56 | FromGitter | <alehander42> hm, so what should we do when package name is taken |
12:42:26 | PMunch | Ask him to rename I guess |
12:42:43 | * | ng0 joined #nim |
12:46:45 | FromGitter | <Willyboar> @alehander42 nothing. CI fails because name exists. |
12:49:24 | FromGitter | <Willyboar> Sorry i thought you are norm owner. Send him a message to change the name is the better solution. :) |
13:04:26 | * | GordonBGood quit (Ping timeout: 240 seconds) |
13:07:27 | * | GordonBGood joined #nim |
13:17:50 | * | thomasross quit (Ping timeout: 268 seconds) |
13:22:49 | * | jjido joined #nim |
13:28:23 | FromDiscord | <Lantos> Is that you Jonas? Someone take the norm name already? |
13:33:55 | * | NimBot joined #nim |
13:34:39 | GordonBGood | mratsim: Araq says that ref counting and cleaning up GC is for Nim version 1.0; looking for ways to combing the use of B/D for Nim version 2.0 - https://irclogs.nim-lang.org/31-10-2019.html#09:51:49 |
13:37:39 | GordonBGood | mratsim: he is thinking of ways to combine ref counting and even cycle detection with B/D, but they perhaps aren't clear and haven't been tried yet |
13:40:22 | * | lritter joined #nim |
13:52:39 | * | shadowbane quit (Quit: Konversation terminated!) |
13:53:59 | PMunch | Hmm, is there anything comparitve to offsetof in Nim? |
13:55:00 | * | hed0n1st joined #nim |
13:56:50 | * | ftsf quit (Ping timeout: 240 seconds) |
14:06:16 | * | ng0_ joined #nim |
14:08:40 | * | ng0 quit (Ping timeout: 260 seconds) |
14:08:41 | leorize | PMunch: system.offsetof? |
14:09:05 | PMunch | Oh |
14:09:11 | PMunch | That simple, eh :) |
14:09:38 | * | GordonBGood quit (Ping timeout: 268 seconds) |
14:09:48 | PMunch | Araq, I remember you mentioning once that the result variable could be directly set in the callers stack. Is this actually done? I look at the generated C code and it appears just like a regular variable. |
14:11:17 | * | ng0_ is now known as ng0 |
14:25:21 | * | thomasross joined #nim |
14:28:19 | * | testgovno[m] quit (Quit: 30 day idle timeout.) |
14:36:26 | Araq | PMunch: it is done if the codegen thinks it's a good idea |
14:39:44 | * | solitudesf joined #nim |
14:44:52 | PMunch | Aha |
14:45:17 | PMunch | And what conditions would make it think that it's a good idea? |
14:57:13 | PMunch | Aha, my DLL issue seems to be what I expected. Somehow my value definition produces different results on Windows and linux |
14:57:20 | PMunch | Now just to figure out which field causes it.. |
14:57:39 | FromDiscord | <mratsim> How come I don't find any paper on MPSC channels/queues backed by a ringbuffer :/ |
15:06:21 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:08:58 | PMunch | @Lantos, you inspired me to write a little article on implicit return values: https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html |
15:09:06 | FromGitter | <kaushalmodi> Is there a way to specify the nimble path? (not append) |
15:09:31 | FromGitter | <kaushalmodi> e.g. `--noNimblePath` removes all nimble pkg paths, while `--NimblePath` appends to existing nimble paths |
15:10:07 | FromGitter | <kaushalmodi> I am maintaining two separate nimble pkgs directories (bleeding edge and stable) and I would like `nim` binary to pick one of the two. How do I do that? |
15:10:20 | * | filcuc joined #nim |
15:10:21 | * | PMunch quit (Quit: Leaving) |
15:10:29 | FromGitter | <kaushalmodi> By default, I have the bleeding edge nimble path as the default `~/.nimble/`. |
15:11:28 | FromGitter | <kaushalmodi> But for work stuff deployment, I am maintaining a separate nimble directory. If I run `nim --NimblePath:/stable/path`, nim still pulls in the bleeding edge version of a nimble pkg from the default ~/.nimble dir |
15:11:36 | FromGitter | <kaushalmodi> Any good solution? |
15:12:49 | * | rockcavera quit (Remote host closed the connection) |
15:14:55 | * | snooptek joined #nim |
15:16:14 | disruptek | kaushalmodi: no solution. it's something we've been discussing recently. |
15:18:08 | FromGitter | <kaushalmodi> hmm, I am using this ugly workaround until then: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5dbc4cb0bbdf5f17b420b286] |
15:19:06 | FromGitter | <kaushalmodi> @Araq May be we need a `--NimblePathOverride` |
15:19:35 | FromDiscord | <mratsim> @kaushalmodi: export NIMBLE_DIR=path/to/nimble |
15:19:51 | FromGitter | <kaushalmodi> oh, that will replace the default nimble dir? |
15:19:55 | FromGitter | <kaushalmodi> *trying it now* |
15:20:01 | disruptek | whoa. |
15:20:32 | FromDiscord | <Rika> PMunch, your blog or site looks nice |
15:20:40 | disruptek | so there's actually 6 things that need to be deprecated and replaced with a single api. 🤣 |
15:21:23 | FromDiscord | <Rika> disruptek is there something wrong with your client, some messages get sent with garbage data at the end |
15:21:41 | disruptek | it's an emoji. |
15:21:50 | disruptek | it's the garbage data emoji. |
15:22:02 | FromDiscord | <mratsim> makes sense |
15:22:16 | FromDiscord | <Rika> are you using unicode? |
15:22:16 | disruptek | it would have to be, right? |
15:22:33 | disruptek | unicode makes my nipples throb. |
15:23:19 | * | thomasross quit (Ping timeout: 265 seconds) |
15:23:32 | FromGitter | <kaushalmodi> @mratsim That env var did not work.. tried setting it to /path/to/nimbledir and also /path/to/nimbledir/pkgs |
15:25:18 | * | shadowbane joined #nim |
15:25:41 | FromGitter | <kaushalmodi> even though that `nimbledir/pkgs/` has `nimterop-#head/` dir, I get: ⏎ ⏎ > Error: cannot open file: nimterop/cimport |
15:25:47 | * | sedfox quit (Ping timeout: 276 seconds) |
15:29:01 | disruptek | just get rid of your ~/.nimble/pkgs. it'll cause nothing but problems because the compiler cannot be made blind to it. |
15:29:27 | disruptek | once that's gone, you can achieve package local deps. |
15:30:23 | FromGitter | <kaushalmodi> looking into source: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ My guess is that `pass==passPP` (whatever that means) is false and so the NIMBLE_DIR is ineffective [https://gitter.im/nim-lang/Nim?at=5dbc4f8e3f4ea333f2c52b94] |
15:31:29 | FromGitter | <kaushalmodi> oh well, I will stick with the above workaround.. cannot get rid of `~/.nimble` |
15:32:16 | * | sedfox joined #nim |
15:32:17 | disruptek | that's the only alternative, yes. |
15:36:03 | FromGitter | <alehander42> obviously |
15:36:03 | FromGitter | <alehander42> https://repl.it/site/blog/upm |
15:36:08 | FromGitter | <kaushalmodi> btw I was looking at the wrong source.. looking at: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ NIMBLE_DIR should work.. but it's not [https://gitter.im/nim-lang/Nim?at=5dbc50e88fbe1d5faba1faaa] |
15:36:18 | FromGitter | <alehander42> i have to share another related to package management link |
15:38:32 | disruptek | that seems worth trying. |
15:43:11 | disruptek | ah, they make you implement the backends in go. |
15:44:39 | * | dddddd joined #nim |
15:50:37 | FromGitter | <alehander42> their software can also be written in nim |
15:50:49 | FromGitter | <alehander42> there are so many of those developer tools that people write in go |
15:50:57 | FromGitter | <alehander42> that nim is a good fit for imo |
15:53:15 | shashlick | running into an issue with cOverride / cPlugin and was wanting some community input cc @kaushalmodi |
15:53:34 | shashlick | https://github.com/nimterop/nimterop/issues/149 |
15:53:53 | * | theelous3 joined #nim |
15:54:22 | shashlick | all calls to cImport will use the preceding cOverride and cPlugin calls |
15:54:48 | shashlick | one way is to clear everything once cImport is done which means every cImport will expect its own cOverride / cPlugin |
15:54:55 | shashlick | but that is big effort for user |
15:55:00 | FromGitter | <kaushalmodi> there's isn't a way to have a `block:` to limit the impact of a cOverride/cPlugin, right? |
15:55:36 | disruptek | it seemed to me that you write a shim that operates a pre-existing package manager; the shim is in go, but admittedly small. still, it begs the question... |
15:55:38 | FromGitter | <kaushalmodi> > one way is to clear everything once cImport is done ⏎ ⏎ Yes, please no :) I have 10 cImports |
15:55:42 | * | filcuc quit (Ping timeout: 265 seconds) |
15:56:35 | shashlick | well, other option is that cPlugin can be shared but cOverride will get consumed and cleared after cImport |
15:57:12 | shashlick | so if you want to override for multiple cImport, you need a cOverride for each |
15:57:55 | FromGitter | <kaushalmodi> But that would mean copy pasting dozens of lines 10 times. |
15:58:16 | shashlick | why? |
15:58:42 | shashlick | you will be cOverriding specific symbols in a subsequent cImport |
15:58:50 | FromGitter | <kaushalmodi> .. because you said that the overrides will auto clear |
15:59:28 | shashlick | it's convenient to put everything in the top no doubt but the way cOverride works, if it finds a symbol that needs overriding, it replaces in place |
15:59:37 | shashlick | at the end, if there are any remaining symbols, it simply adds those to the top |
15:59:42 | FromGitter | <kaushalmodi> Hmm.. now that I think about it, I will need to copy paste types reused in multiple comports, but not that many |
15:59:53 | shashlick | so it is not designed to wait to override in later cimports |
16:00:29 | shashlick | and I don't see a way to do both - adding symbols vs. retaining for later cimports |
16:00:45 | FromGitter | <kaushalmodi> I can try out a branch with your proposal |
16:01:08 | shashlick | does your cOverride right now include symbols across multiple cImports? |
16:01:50 | FromGitter | <kaushalmodi> It includes consts which are reused in repeated cimports |
16:02:14 | shashlick | That's cause they are symbols you aren't overriding but simply injecting |
16:03:20 | shashlick | In fact subsequent cimports will reinject even override symbols since it won't see them in the next header |
16:03:46 | shashlick | I'm open to ideas but don't see a better way |
16:04:24 | yumaikas | dom96: Made a small thing in Jester last night: https://github.com/yumaikas/comic-trakr |
16:04:49 | FromGitter | <kaushalmodi> shashlick: Should there be a cache of previously injected symbols? |
16:04:59 | yumaikas | Going to use it as the example for the cookie-counter bit of the docs, but wanted a way to keep my place in a webcomic without mucking with history and the like |
16:05:13 | FromGitter | <kaushalmodi> Because all the symbol injection happens in the global scope, right? |
16:05:31 | shashlick | Everything in cOverride gets injected in first cImport |
16:06:05 | shashlick | Either in place or at the top since there's no way to know the user's intention |
16:06:16 | FromGitter | <kaushalmodi> Now that you would have it autoclearing, it probably won't be an issue |
16:06:27 | FromGitter | <kaushalmodi> Hmm.. I would like to try it out. |
16:06:45 | shashlick | If an override is relevant to a third cImport I think it should be next to it anyway |
16:07:02 | FromGitter | <kaushalmodi> Makes sense. |
16:07:03 | shashlick | But this is more being expected from the user |
16:07:41 | shashlick | Can you also share the const that isn't getting wrapped? |
16:09:14 | * | nixfreak_work joined #nim |
16:09:45 | FromGitter | <kaushalmodi> I have this in the .h file: ⏎ ⏎ ```# Declaration 'NO_OF_PROFILES' skipped``` [https://gitter.im/nim-lang/Nim?at=5dbc58c96570b076740f6f21] |
16:10:23 | FromGitter | <kaushalmodi> So I add it manually using: ⏎ ⏎ ```cOverride: ⏎ const ⏎ NO_OF_PROFILES* = 4``` [https://gitter.im/nim-lang/Nim?at=5dbc58efa85791488f895aa8] |
16:11:48 | FromGitter | <kaushalmodi> oops, we should be in nimterop channel? |
16:12:21 | shashlick | ya we can continue there - just wanted to ask the cOverride question in front of more eyes |
16:12:39 | shashlick | nimterop doesn't wrap consts today, just #defines |
16:13:09 | yumaikas | @dom96: Also, I have a PR in to remove the devel compiler notice from the Jester readme. |
16:21:55 | * | filcuc joined #nim |
16:22:27 | FromGitter | <brentp> how can I set precision of floats in json output? I tried definding `$` for floats, but it doesn't get used. |
16:23:25 | disruptek | you shouldn't really be able to do that. |
16:24:00 | disruptek | use a string if you want to approximate a number. |
16:24:44 | disruptek | btw, thanks for plotly. i'm looking forward to using it. |
16:27:43 | FromGitter | <brentp> sure thing. though most of it is done by @Vindaar, by now. |
16:28:59 | * | nixfreak_work quit (Ping timeout: 260 seconds) |
16:37:11 | * | MagicMissile joined #nim |
16:38:10 | FromGitter | <Vindaar> @brentp I don't think there's an easy way. Both `toUgly` and `toPretty` just call `addFloat` https://github.com/nim-lang/Nim/blob/devel/lib/pure/json.nim#L745 |
16:38:49 | FromGitter | <Vindaar> oh, wait. `addFloat` itself just calls `$` so hmm |
16:39:43 | * | Vladar joined #nim |
16:48:32 | * | solitudesf quit (Quit: Leaving) |
16:49:12 | * | hed0n1st quit (Quit: Leaving) |
16:56:24 | * | solitudesf joined #nim |
17:01:49 | MagicMissile | Why nested for loop so slow? https://play.nim-lang.org/#ix=20vn Without the -d: release flag of course |
17:02:48 | FromGitter | <alehander42> 10_000 ** 2 |
17:02:53 | FromGitter | <alehander42> is 100_000_000 |
17:02:56 | FromGitter | <alehander42> not 10_000_000 |
17:03:43 | FromGitter | <alehander42> it happens, thats why |
17:03:53 | FromGitter | <alehander42> using `_` is cool when you have it |
17:06:56 | * | ng0 quit (Ping timeout: 260 seconds) |
17:07:48 | FromGitter | <brentp> plus you're not resetting j in the while loop. |
17:12:37 | * | ng0 joined #nim |
17:19:04 | * | narimiran joined #nim |
17:19:23 | MagicMissile | Corrected https://play.nim-lang.org/#ix=20vQ But the difference with the -d: release flag is annoying |
17:20:18 | FromDiscord | <Lantos> @PMunch good stuff |
17:20:19 | FromDiscord | <Lantos> templates are cool |
17:20:56 | FromGitter | <brentp> @MagicMissile use -d:danger |
17:39:38 | rayman22201 | @araq poke. you around? |
17:44:40 | * | MagicMissile quit (Remote host closed the connection) |
17:58:26 | * | clyybber joined #nim |
18:06:30 | clyybber | MagicMissile: WDYM "annoying"? Would you rather have everything be slow? |
18:06:45 | * | Jesin quit (Quit: Leaving) |
18:07:24 | rayman22201 | so what does it mean when a GC crash goes away when you turn on `-d:leakDetector` lol? |
18:07:52 | rayman22201 | is it the classic, "it hurts until you see the doctor, then it goes away?" :-P |
18:08:54 | rayman22201 | This smells like an alignment bug.... |
18:10:25 | * | nsf joined #nim |
18:11:53 | * | Jesin joined #nim |
18:12:58 | clyybber | Araq: Ha, I found a bug in semobjconstr by looking at the code.. |
18:14:10 | clyybber | If you provide only a runtime value to the discriminator that has a range type that only fits in one branch, it will still check all branches for mandatory fields.. |
18:14:59 | disruptek | that's only on ranges? |
18:15:06 | clyybber | rayman22201: heisenbug |
18:15:07 | disruptek | 'cause that feels like the same bug we already saw. |
18:15:15 | clyybber | disruptek: Yeah, thats only on ranges |
18:15:21 | clyybber | disruptek: Which bug? |
18:15:24 | clyybber | It was no bug |
18:15:37 | clyybber | DateTimeLocal is a mandatory field |
18:15:57 | disruptek | yes, but not given the value of the runtime. |
18:15:57 | clyybber | And thus needs to be initialized, which means the compiler needs to know which branch will be taken |
18:16:17 | rayman22201 | oh no @clyybber. It's very reproducible. turn the flag off, it crashes consistently in the same spot. turn the flag on, it goes away. |
18:16:37 | disruptek | it's a schrodinger bug, then. |
18:16:43 | rayman22201 | :-P |
18:16:47 | clyybber | yeah that fits better |
18:16:54 | rayman22201 | meow |
18:17:17 | clyybber | disruptek: lemme pull that snippet up and check again |
18:17:57 | disruptek | the compiler produces an error about `b uninit'd` but b isn't in the branch given the runtime value. change the runtime to a const and it works. |
18:18:31 | disruptek | maybe the code for ranges was copied and the bug copied with it. |
18:19:42 | clyybber | damnit |
18:19:45 | clyybber | cant find the snippet |
18:20:02 | * | filcuc quit (Ping timeout: 240 seconds) |
18:20:17 | clyybber | disruptek: But it makes sense, because it is not clear at compile time which branch will be taken |
18:20:30 | clyybber | and thus the initalization of DateTimeLocal can not be guaranteed |
18:20:59 | rayman22201 | re: my bug: The `-d:leakDetector` flag adds extra fields to GC Cell objects, this really makes me think it's an alignment bug.... |
18:21:26 | clyybber | rayman22201: Makes sense, are you working on async again? |
18:21:32 | disruptek | https://github.com/nim-lang/Nim/issues/11428 |
18:22:06 | rayman22201 | @clyybber. Yeah. I think I have a solution to make async work with dispose/ AraqGC |
18:22:44 | clyybber | nice |
18:22:49 | clyybber | disruptek: Thanks |
18:23:09 | clyybber | disruptek: The issue will be solved with defaultfields |
18:23:12 | clyybber | eventually |
18:23:20 | disruptek | i get why it happens, i just think if you're able to fix ranges, you'll be able to fix that the same way. |
18:23:23 | clyybber | but not the issue in your snippet |
18:23:43 | clyybber | disruptek: But that means I generate a case statement after the object constructor |
18:23:48 | clyybber | and that has a runtime impact |
18:24:14 | disruptek | it should be a new check, then. |
18:24:43 | clyybber | disruptek: I'm not sure what exactly you mean |
18:25:00 | clyybber | I can implement default values for ranges and other types |
18:25:29 | clyybber | but the branches they are in have to be selected at compile time. |
18:25:30 | disruptek | the runtime cost should be borne by !release builds. |
18:26:04 | clyybber | disruptek: No, it would generate assignments not checks |
18:26:56 | disruptek | i mean, just don't generate them. |
18:27:01 | disruptek | let the code crash. |
18:27:05 | clyybber | Ah |
18:27:10 | clyybber | Umm |
18:27:25 | clyybber | but that means that some code will work with -d:release and crash with danger |
18:27:29 | clyybber | and thats broken |
18:27:39 | clyybber | unless I error on -d:release |
18:27:52 | clyybber | but then again I can catch the possibility at compile time and thats better |
18:27:59 | clyybber | IMO |
18:28:28 | clyybber | and if we get better deduction for case statements it also won't be so bothersome |
18:29:19 | clyybber | type |
18:29:21 | clyybber | needsInit = object |
18:29:22 | disruptek | hmm, you're right, this won't make any sense. |
18:29:23 | clyybber | v: range[1..11] |
18:29:25 | clyybber | cObj = object |
18:29:27 | clyybber | case i: int |
18:29:29 | clyybber | of 0..3: |
18:29:31 | clyybber | v: int |
18:29:33 | clyybber | of 4..7: |
18:29:35 | clyybber | n: needsInit |
18:29:37 | clyybber | else: |
18:29:39 | clyybber | d: uint |
18:29:41 | clyybber | proc test(i: range[0..3]) = |
18:29:43 | clyybber | echo cObj(i: i) |
18:29:45 | clyybber | Sorry for the paste |
18:29:47 | clyybber | But this is the bug I found |
18:29:49 | clyybber | which really is a bug |
18:29:51 | clyybber | Since the compiler shouldn't error on this code. |
18:30:04 | clyybber | Or should it? |
18:30:05 | disruptek | well that's clearly broken. |
18:30:19 | clyybber | Hmm. at least it shouldn't with default objects |
18:30:22 | clyybber | fields |
18:31:28 | clyybber | yeah its broken, with or without default fields |
18:31:30 | clyybber | heh |
18:31:33 | clyybber | time to fix it |
18:33:27 | clyybber | and fix the bad fields initialized error along the way |
18:33:36 | clyybber | because that sucks |
18:34:03 | disruptek | booyah 😊 |
18:34:06 | clyybber | disruptek: low for range types as a default makes sense right? |
18:34:13 | disruptek | yes. |
18:34:23 | disruptek | also enums. |
18:34:30 | clyybber | If people want to overwrite it they can use default values |
18:34:34 | clyybber | disruptek: Yeah enums |
18:34:37 | clyybber | also |
18:35:09 | disruptek | this is good stuff you're doing. 🎉 |
18:35:27 | clyybber | thanks |
18:37:06 | clyybber | disruptek: Should I error like we do for range types if enums could end up in an invalid state? |
18:37:11 | clyybber | Of course only for non holy enums |
18:37:25 | disruptek | how could non-holy enums end up invalid? |
18:37:32 | clyybber | + 1 |
18:37:36 | clyybber | inc e |
18:37:43 | clyybber | e += 1 |
18:37:52 | clyybber | oh |
18:37:56 | clyybber | non holy enums |
18:37:57 | disruptek | oh. gah how can you check that? |
18:38:10 | clyybber | disruptek: I'm dumb I thought you wrote holy enums |
18:38:26 | clyybber | For non-holy ones its easy |
18:38:32 | clyybber | No |
18:38:45 | clyybber | its not. But hey I don't think we check it ucrrently |
18:38:50 | disruptek | at compile time? |
18:39:02 | clyybber | ah right, we check at runtime |
18:39:04 | clyybber | I think |
18:39:11 | clyybber | but I'm not sure if we do for enums |
18:39:29 | disruptek | sounds like a debug flag that's off for release, but, yeah. |
18:39:30 | clyybber | At least for enums with holes (holy enums) it doesn't make sense to check |
18:40:02 | disruptek | how are holy enums implemented? i can't remember. |
18:40:20 | clyybber | brb asking the pater |
18:40:54 | clyybber | s/pater/pastor |
18:41:12 | clyybber | or priest or how its called |
18:41:37 | clyybber | disruptek: They are just an ints with aliases |
18:41:39 | clyybber | as all enums |
18:41:48 | clyybber | and with a $ implementation I think |
18:42:08 | disruptek | so right now i can give an enum a bogus value with inc? |
18:42:25 | clyybber | For a holed enum yeah |
18:42:32 | clyybber | For a non-holed one, not so sure |
18:42:39 | clyybber | need to check |
18:43:05 | disruptek | i thought they were a set of range[short]. |
18:43:30 | clyybber | a set? |
18:43:42 | clyybber | huh |
18:43:52 | disruptek | no, not a set. but maybe i'm confusing this with some other lang. |
18:44:08 | clyybber | you can make an enum thats the size of an int64 |
18:44:14 | clyybber | I think |
18:45:49 | rayman22201 | For @Araq and anybody who wants to follow along: I have a GC bug. I don't have a "minimal" repro, but hopefully it's small enough |
18:46:00 | clyybber | paste it in irc |
18:46:02 | clyybber | for the lulz |
18:46:05 | disruptek | lol |
18:46:42 | clyybber | and while you are at it rename all variables to members that are currently online |
18:46:52 | disruptek | omg |
18:47:06 | rayman22201 | https://github.com/nim-lang/Nim/compare/devel...rayman22201:async-with-dispose |
18:47:10 | rayman22201 | starting from here |
18:47:40 | clyybber | proc disruptek(d: isruptek) = d.isruptek |
18:48:02 | clyybber | sorry I made you a useless proc disruptek.. |
18:48:12 | rayman22201 | This is the failing test: https://github.com/nim-lang/Nim/blob/devel/tests/async/tnewasyncudp.nim#L55 |
18:48:13 | disruptek | don't sweat it; all my procs are useless. |
18:48:20 | clyybber | thats the spirit |
18:49:13 | rayman22201 | here is the stack trace: https://www.irccloud.com/pastebin/GTqWiFY0/ |
18:49:47 | rayman22201 | turning on `-d:leakDetector` makes the test pass. |
18:49:49 | Araq | this is not a GC bug, you inject the new 'dispose' calls |
18:50:01 | Araq | and apparently not in the right place |
18:50:17 | rayman22201 | I don't believe that is the case. I am confident they are in the right place. |
18:50:41 | rayman22201 | if they were in the wrong place, `-d:leakdetector` would not suddenly make it work? |
18:50:46 | clyybber | Araq: Do we currently range check enums? |
18:51:13 | Araq | sure they would, a memory corruption is not deterministic |
18:51:28 | Araq | so changing anything unrelated can influence it |
18:51:41 | rayman22201 | let me clarify. I do think the new `dispose` causing the issue. But I don't think it's the fault of `dispose`. I think the GC is doing something wrong. |
18:52:20 | Araq | which is why memory safety is such a big thing, without it you need non-local reasoning for everything |
18:52:31 | FromDiscord | <kodkuce> some dude haraisng me to do some c# for 50$, like i am doing it and am now like wtf its slow to type nim faster, like now am even frogoting to type ; end of line |
18:53:14 | rayman22201 | follow me on the bug here. I think something very specific is going on that I want to understand. |
18:53:58 | Araq | rayman22201: you dispose(x), other pointers to x must not exist |
18:54:08 | clyybber | kodkuce: I feel you. |
18:54:18 | Araq | otherwise the GC follows these pointers and crashes as in your stack trace |
18:54:23 | clyybber | java is even more extreme |
18:54:55 | FromDiscord | <kodkuce> pain is real 🙂 |
18:55:06 | Araq | -d:leakDetector is heavy, it changes the involved object sizes |
18:55:36 | rayman22201 | right. Why would the size change a lifetime bug? |
18:57:31 | rayman22201 | also, if the lifetimes were wrong, wouldn't the GC crash on the first mark pass? not let the loop run for many iterations before crashing? |
18:59:37 | * | cyraxjoe quit (Ping timeout: 240 seconds) |
19:00:17 | Araq | -d:nimBurnFree to make it crash faster |
19:01:05 | Araq | but no, it doesn't have to crash on the first mark pass, it's all quite unpredictable |
19:01:23 | Araq | clyybber: we do check range enums |
19:01:46 | clyybber | Araq: So does an enum field make an object nfRequiresInit currently? |
19:02:04 | Araq | it if lacks myenum(0) |
19:02:10 | Araq | *if it |
19:02:12 | clyybber | Ok |
19:02:21 | clyybber | So I won't be breaking any code |
19:02:23 | clyybber | good |
19:02:31 | clyybber | thanks |
19:02:53 | * | cyraxjoe joined #nim |
19:03:21 | rayman22201 | What I believe is happening: https://www.irccloud.com/pastebin/btk14aPk/ |
19:03:30 | * | rockcavera joined #nim |
19:03:31 | rayman22201 | can you confirm this Araq? |
19:03:53 | rayman22201 | If so, is there a way to transfer ownership of the pointer from step 1? |
19:03:56 | Araq | sounds likely |
19:04:08 | FromDiscord | <eacyy> I'm on Discord. Can you guys actually see Discord's code formatting stuff? |
19:04:08 | FromDiscord | <eacyy> ```nim |
19:04:08 | FromDiscord | <eacyy> echo "Is this being formatted on your platform/site?" |
19:04:08 | FromDiscord | <eacyy> ``` |
19:04:23 | rayman22201 | the proc needs to be able to relinquish ownership of that pointer. |
19:04:47 | Araq | rayman22201: however 'dispose' does 'nil' out the pointer and it's transformed into someClosure.fut |
19:05:08 | Araq | so it's hard to see where the remaining refs come from |
19:05:30 | rayman22201 | there can only be that one ref AFAIK |
19:06:30 | rayman22201 | the closure from here: https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L1469 |
19:07:17 | rayman22201 | well, 2 refs. One ref for the await itself obviously + the ref for the socket callback closure. |
19:07:18 | * | jjido joined #nim |
19:08:39 | rayman22201 | my printf debugging and the stack trace seem to support this |
19:09:10 | rayman22201 | somehow the `dispose` call does not `nil` out the closure.fut ref |
19:09:30 | Araq | let's assume that's the case. the problem is there are other allocations |
19:09:51 | Araq | can we 'dispose' them all properly for the common async cases? |
19:10:07 | rayman22201 | which other allocations? |
19:10:49 | rayman22201 | for the special case of closure.fut I know (Because of the cpc paper) that it is safe to nill that reference. |
19:10:49 | Araq | the closures, for example |
19:11:53 | Araq | surely looks like it, yeah |
19:11:55 | * | jjido quit (Client Quit) |
19:12:05 | Araq | but that's 1 allocation out of 3 or 4 |
19:12:27 | rayman22201 | for the general case of everything in a closure environment, harder to answer. I have to think about it harder. |
19:12:32 | rayman22201 | But that is the entire point of dispose |
19:12:47 | rayman22201 | you know some particular ref is safe to destroy |
19:12:50 | rayman22201 | so you destory it |
19:12:57 | rayman22201 | *destroy |
19:13:20 | Araq | sure |
19:14:21 | rayman22201 | I can also reasonably say that for this particular closure, it's safe to destory it. The socket read is finished, and the promise has been read. (That is why the GC is kicking in for that closure anyway.) |
19:14:37 | rayman22201 | that doesn't extend to the general case of course |
19:15:52 | rayman22201 | essentially, b/c I have extra information about this case, I was able to call 'dispose' and free one small piece of the closure environment a little bit early. |
19:16:33 | clyybber | Araq |
19:16:36 | clyybber | proc test(i: range[0..3]) = |
19:16:38 | clyybber | echo cObj(i: i) |
19:16:39 | rayman22201 | brb |
19:16:40 | clyybber | y |
19:16:55 | clyybber | In this snippet the type of i in the object constructor is tyInt |
19:16:59 | clyybber | and not tyRange? |
19:17:04 | clyybber | Thats a bug right? |
19:19:29 | Araq | looks like it |
19:22:49 | ehmry | I'm crawling the nimble package list, and there are more packages without version tags than with tags |
19:23:12 | shashlick | meh, not able to code, brain isn't working |
19:23:17 | ehmry | version your code people |
19:24:17 | FromGitter | <brentp> @mratsim, what would be the way to do something like this in Arraymancer given 2D tensor Q: `(Q.astype(int) == -1).mean(axis=0)` ? |
19:26:28 | ehmry | the good news is that we are over 1K packages |
19:29:33 | Araq | ehmry: yeah, I stopped "new runtime" development after this threshold :P |
19:30:12 | Araq | we don't need a Python 2/3 situation |
19:30:54 | Araq | (there were other reasons too, for example "it doesn't actually work") |
19:31:59 | ehmry | FWIW we probably don't have 1K packages that pass their own tests |
19:32:35 | ehmry | I shouldn't say that, I have no idea |
19:42:06 | rayman22201 | @Araq I'm on my phone but I'm online |
19:42:24 | rayman22201 | Does what I said make sense? |
19:42:49 | Araq | rayman22201: yes but I dunno if I'll fix it, 1 out of 4 allocations ain't good enough |
19:43:03 | * | nxl4_ joined #nim |
19:43:07 | rayman22201 | I don't understand why |
19:43:26 | rayman22201 | It's arguably the most important one |
19:44:06 | nxl4_ | Hello, is anyone aware of documentation that could explain Nim throwing this error: "Error: unhandled exception: Parsed integer outside of valid range [ValueError]" |
19:44:20 | rayman22201 | Ok. Well, I have an alternative if you don't want to fix it. I don't think it's as elegant though. |
19:44:38 | nxl4_ | It's in response to this line of code: |
19:44:39 | nxl4_ | let jsonRsp = parseJson(rspJson) |
19:45:01 | nxl4_ | I can compile some JSON objects fine, but others will throw the error. |
19:45:58 | nxl4_ | I know that the JSON object is valid. It's coming from the Shodan API, and is parsed fine by jq. |
19:48:14 | disruptek | yeah, it happens with large numbers. |
19:48:30 | disruptek | integers, that is. |
19:48:52 | rayman22201 | I could actually dispose the entire closure if I could get access to the closure environment ptr |
19:49:12 | rayman22201 | But I don't think I have a way to get access to that |
19:49:45 | rayman22201 | That's the problem with implicit closure allocation |
19:50:24 | * | Perkol joined #nim |
19:50:51 | Araq | someproc.rawPtr exists |
19:51:31 | Araq | JSON doesn't have "large" numbers |
19:51:39 | Araq | jq is not a JSON validator |
19:53:09 | rayman22201 | Hrmmm. Interesting. If I could have the future also return that ptr it might work... |
19:54:34 | disruptek | i only see overlarge numbers in json from microsoft. go figure. |
19:55:46 | rayman22201 | My alternative solution is to have async procs use an "out" param for the future, instead of allocating their own future directly. Then the parent has total control of the lifetime of the future. I think this is closer to what the cpc paper does. It's a much bigger change to how async works though... |
19:56:10 | Araq | rayman22201: I like it |
19:56:19 | Araq | could help in all sort of ways |
19:56:28 | rayman22201 | Lol. Ok then |
19:56:30 | nxl4_ | Any known methods of dealing with the overlarge integer issue for JSON parsing? |
19:56:40 | Araq | but them inside "" |
19:56:46 | Araq | *put |
19:56:47 | Araq | lol |
19:57:48 | nxl4_ | Well...since it's coming from an API... |
19:57:58 | nxl4_ | I'm guessing it's this one: "serial": 4.647487688093299e+37 |
19:59:30 | Araq | maybe don't map it to an integer type |
19:59:47 | Araq | looks like a floating point number to me |
20:00:23 | disruptek | nxl4_: are you using openapi for this? |
20:01:17 | nxl4_ | disruptek: Is that a module? If so, I'm not. I'm just using httpClient and json for this part. |
20:02:08 | disruptek | okay, i was just curious if it was based on a swagger/openapi definition. |
20:02:23 | nxl4_ | Also, I'm not generating the JSON, I'm pulling it down from a REST API. |
20:02:44 | nxl4_ | So, I can't control the format of the raw data; I'm just trying to parse it. |
20:02:45 | disruptek | the idea of using a float as a serial kinda blows my mind. |
20:02:58 | * | Jesin quit (Quit: Leaving) |
20:03:33 | rayman22201 | I have a second problem with async. Loops... Is there an elegant way to get a "last read of" a symbol? |
20:03:49 | nxl4_ | Looks like that's how Shodan's presenting SSL cert serials. |
20:04:31 | disruptek | put shodan on the phone; lemme talk to him. |
20:04:35 | disruptek | i'll straighten this bozo right out. |
20:04:37 | rayman22201 | The cpc paper solves this by converting loops into recursive calls. Which is lame imo. |
20:05:11 | nxl4_ | lol, yeah I'll get John M on the line right away |
20:07:34 | rayman22201 | Although, making all loops async would "increase the async-ness" of the system overall... That could be advantageous? |
20:07:58 | Araq | I doubt it |
20:09:29 | rayman22201 | Lol... Yeah... |
20:10:58 | rayman22201 | If there isn't some pass I can already leverage, my idea is to make a poor man's "last read of" pass inside the async macro itself. |
20:12:57 | Araq | well in the compiler I have this knowledge but it's hard to expose |
20:13:26 | Araq | for a prototype you can annotate it on your own inside .async, no need to compute it |
20:13:58 | rayman22201 | Fair enough |
20:14:58 | FromGitter | <kaushalmodi> Araq: A minor question about the `zip` proc in sequtils.. ⏎ ⏎ It's signature is `proc zip*[S, T](s1: openArray[S], s2: openArray[T]): seq[tuple[a: S, b: T]] =` |
20:15:27 | FromGitter | <kaushalmodi> yesterday, I was using it to create seqs to pass to another proc expection seq's of 2-field tuples |
20:15:28 | clyybber | disruptek: shodan sent you a message via nim docs |
20:15:47 | FromGitter | <kaushalmodi> problem is that the returned seq by zip is a seq of named tuples |
20:16:22 | FromGitter | <kaushalmodi> so the other proc won't take the `zip` returned seq unless on both sides, the tuples have the exact `a` and `b` fields |
20:16:38 | FromGitter | <kaushalmodi> does it make sense to have `zip` return anon tuple seq i.e. no field names? |
20:16:46 | disruptek | yes. |
20:16:48 | Araq | definitely |
20:16:55 | rayman22201 | I still need to detect a 'future.read' inside a loop, since the dispose can only be called after the loop completes |
20:17:04 | FromGitter | <kaushalmodi> Araq: OK, PR upcoming |
20:17:18 | disruptek | or, just name all your tuple pairs a: and b:. problem solved. 🤣 |
20:17:24 | FromGitter | <kaushalmodi> heh |
20:17:28 | rayman22201 | Lol 😆 |
20:17:30 | disruptek | thanks for fixing that. |
20:18:05 | FromGitter | <kaushalmodi> `zip` is useful.. found its use 2 days back.. but was stumped seeing its marriage with a and b fields |
20:18:55 | disruptek | there are a few things like that in stdlib. |
20:19:23 | disruptek | https://github.com/disruptek/foreach |
20:19:34 | disruptek | helps me trip over them all the time. |
20:28:35 | Araq | rayman22201: you should call GC_disable() and see you can get a stable memory usage |
20:28:48 | FromGitter | <kaushalmodi> done: https://github.com/nim-lang/Nim/pull/12575 |
20:28:52 | Araq | aka injecting 'dispose' in all the right places |
20:29:15 | FromDiscord | <ndl> hi |
20:29:20 | * | Jesin joined #nim |
20:30:01 | Araq | hi, ndl |
20:30:52 | rayman22201 | Currently, The closures will leak (unless there is some distructor for the closure that don't know about) |
20:31:16 | Araq | Future.T which is often a string should also leak |
20:31:27 | rayman22201 | I don't think so |
20:31:36 | rayman22201 | But I can check |
20:39:00 | * | Perkol quit (Quit: Leaving) |
20:40:05 | * | nxl4_ quit (Quit: Konversation terminated!) |
20:41:12 | * | exelotl joined #nim |
20:42:59 | * | GordonBGood joined #nim |
20:46:23 | rayman22201 | What are the 4 allocations? The closure, the Future, the T, ... What else? |
20:47:27 | * | GordonBGood quit (Ping timeout: 264 seconds) |
21:04:02 | FromDiscord | <mratsim> omg, the discord bot is awful to full IRC/Gitter conversion :/ |
21:05:51 | * | rockcavera quit (Remote host closed the connection) |
21:08:02 | FromGitter | <nixfreakz_twitter> @yglukhov Are you still working on nimX ? |
21:08:13 | FromDiscord | <mratsim> btw, can I pass a closure to another thread? is it thread safe? |
21:11:09 | rayman22201 | If you use boehm it is 😛 |
21:12:06 | rayman22201 | What is the type of a closure env? rawEnv returns an untyped ptr |
21:12:46 | rayman22201 | Different question, @Araq can I expose a version of dispose that takes a ptr? |
21:13:26 | rayman22201 | Oh wait. NVM. You already solved this. I didn't see the overload |
21:15:26 | FromDiscord | <mratsim> @rayman22201 "proc (param: pointer) {.closure.}" |
21:15:37 | shashlick | @kaushalmodi - i have a fix, are you able to test? |
21:16:07 | FromDiscord | <mratsim> ah I didn't understand your question |
21:16:21 | FromDiscord | <mratsim> I'm curious, it's probably magic hidden deep in the compiler |
21:16:30 | FromDiscord | <mratsim> (th type of the closure environment that is) |
21:20:08 | * | clyybber quit (Quit: WeeChat 2.6) |
21:27:39 | shashlick | @kaushalmodi - i have created branch `issue149` for you to try, please let me know if it works for you |
21:29:51 | rayman22201 | Lucky for me, Araq already figured it out. I just need to read better lol 😛 |
21:30:28 | dom96 | hey all, what's new? |
21:31:35 | * | thomasross joined #nim |
21:33:09 | rayman22201 | Hey Dom. I think I'm close to getting async working with araqGC. Maybe... Lol 😆 |
21:36:50 | dom96 | nice, but what is `araqGC` again? :) |
21:38:10 | shashlick | @dom96 - please clear my choosenim PR |
21:38:35 | rayman22201 | Hybrid between boehm and C++ style manual mm. A compromise / alternative for newruntime |
21:41:25 | dom96 | shashlick, merged |
21:47:38 | shashlick | thanks! |
21:47:58 | shashlick | when would you like to spin the next release? or are there some other things you'd like to fix before that |
21:48:25 | * | Trustable quit (Remote host closed the connection) |
21:49:29 | dom96 | would be nice to fix this: https://github.com/dom96/choosenim/issues/116 |
21:49:37 | dom96 | and see if there are other high pri bugs |
21:49:46 | * | GordonBGood joined #nim |
21:50:50 | * | narimiran quit (Ping timeout: 240 seconds) |
21:57:14 | Araq | rayman22201: closure + closure iterator + Future + T, 4 allocations |
21:57:25 | dom96 | ooh, just realised our user record has been broken |
21:57:40 | FromGitter | <kaushalmodi> shashlick: It works perfectly! |
21:57:45 | dom96 | Last time we had 170 users was in 2015 |
21:57:57 | Araq | yaaayy... |
21:58:15 | Araq | but this predates all these bridges we have |
21:58:23 | Araq | so you cannot count it anymore |
21:58:38 | dom96 | it makes it even more impressive |
21:58:43 | dom96 | I can still count it |
21:59:03 | shashlick | Cool I'll take a look |
21:59:17 | shashlick | @Araq any favorite choosenim bugs you want addressed? |
21:59:33 | Araq | they are all marked with a tag |
21:59:39 | FromDiscord | <kodkuce> how much now users? |
21:59:48 | shashlick | I'm in the middle of the nimble local deps proposal, there are caveats |
21:59:55 | shashlick | Will share soon |
21:59:57 | Araq | were "acceptance criteria" before choosenim can becomes the official way to install Nim. |
22:01:38 | * | nsf quit (Quit: WeeChat 2.6) |
22:02:12 | dom96 | kodkuce: 177 |
22:02:34 | shashlick | Not able to find the list on the phone, will check later |
22:02:53 | FromDiscord | <kodkuce> where you read that 177 |
22:03:26 | dom96 | IRC |
22:05:34 | shashlick | Thanks @kaushalmodi |
22:05:47 | rayman22201 | The iterator. Of course! |
22:06:13 | FromDiscord | <kodkuce> does discord bot show me on IRC too? |
22:06:22 | FromDiscord | <kodkuce> or you just using IRC as ref 🙂 |
22:08:11 | Araq | GordonBGood: I found the problem |
22:09:09 | * | mwbrown quit (Excess Flood) |
22:09:18 | dom96 | kodkuce: the latter |
22:09:36 | * | mwbrown joined #nim |
22:11:25 | GordonBGood | Araq: ah good on the problem, is it hard to fix? |
22:11:36 | Araq | don't think so |
22:12:00 | rayman22201 | @Araq, a very simple test using Future[string] shows 3 out of 4 things get freed with my dispose calls. |
22:12:25 | rayman22201 | which seems to line up with what I expect |
22:12:37 | rayman22201 | only the closure can't be freed |
22:13:10 | Araq | with a backref from the Future to the closure it could be |
22:13:50 | rayman22201 | yeah. I think so |
22:14:17 | Araq | impressive results |
22:14:21 | GordonBGood | Araq, Ah, good if it's easy to fix - was I right that the leak has been lurking all this time but just didn't come up for most use cases when there was GC? |
22:14:57 | Araq | nah, it's specific to --gc:destructors |
22:16:13 | GordonBGood | Does it explain why we can't see trace the TestObj destructor calls in both --gc:destructors and "ordinary" GC? |
22:18:00 | GordonBGood | If I make a raw allocation within TestObj and dealloc it in the =destroy, it never gets deallocated when it's moved to a closure environment for all GC's and --gc:destructors |
22:18:41 | GordonBGood | memory use continuously increased with repeated creation of the "tst" closures |
22:20:04 | Araq | =destroy is not called, the memory itself is freed afaict |
22:20:31 | GordonBGood | Araq: I've also been thinking about what you said about not liking repr for the new destructors/newruntime modes, you said you didn't like the use of RTTI |
22:20:50 | GordonBGood | Do you see the way forward gradually eliminating RTTI? |
22:21:48 | Araq | we can keep it and generate it on demand |
22:21:49 | GordonBGood | "=destroy" is indeed not used; isn't that a problem when an object relies on =destroy to do clean up of raw allocations? |
22:22:25 | GordonBGood | I see that the memory itself is freed |
22:23:43 | GordonBGood | For legacy GC, in this situation we would just write a finalizer to do the clean up, but I'm don't think we can write a finalizer that would work for the closure captures in destrucors/newruntime |
22:24:36 | GordonBGood | ? |
22:27:23 | Araq | it's a bug affecting destructors, I'm fixing it. should be backported to 1.0 |
22:29:25 | GordonBGood | Araq: Okay on the bug in destructors, I'll check that again when you commit - but would you mind having a look at this "causing memory leak even within GC"? |
22:30:04 | GordonBGood | I'll simplify the MCVE more than last tiime along the lines we discussed :) |
22:30:25 | Araq | report it on github |
22:30:56 | GordonBGood | OK, I'll file an issue |
22:32:02 | Araq | but I know there is no leak because it's logically impossible, the GC doesn't know about closures, it's all lowered to 'new' and has been stress tested to death :P |
22:33:30 | GordonBGood | Araq, I am maybe/probably misunderstanding my own test, but instrumentation says I'm causing a memory leak even using refc GC |
22:34:12 | GordonBGood | But embarrassement doesn't matter to me in the search for further knowledge ;) |
22:34:46 | disruptek | everyone says that before they get into porn. |
22:35:37 | GordonBGood | disruptek: I had better qualify that be qualifying it with "as applied to Nim" then |
22:37:08 | GordonBGood | Araq: do you want me to file an issue on the following gist as well: https://gist.github.com/GordonBGood/705a1faa51eabb72514b6b976d5dc47d |
22:37:18 | FromDiscord | <kodkuce> embarrasment is for pussys |
22:37:39 | FromDiscord | <kodkuce> i infront declare myself as crazy newb xD |
22:37:41 | shashlick | @Araq - are these really all that remain on your wishlist? https://github.com/dom96/choosenim/milestone/1 |
22:37:41 | GordonBGood | I think it may be simpler as it definitely only applies to destructors |
22:37:57 | FromDiscord | <kodkuce> but 1 day will get my revange |
22:38:42 | FromDiscord | <kodkuce> i go sleep cya all |
22:38:50 | disruptek | peace puppy |
22:40:24 | Araq | shashlick: yes. |
22:42:25 | shashlick | well, life is allowed to appear easy sometimes |
22:45:53 | shashlick | @kaushalmodi - made a minor change, can you please retest if you have time? |
22:49:46 | GordonBGood | Araq: I'll hold off on filing the first issue until I see if your fix of the destructor issue also fixes this... |
22:50:16 | * | solitudesf quit (Ping timeout: 240 seconds) |
22:51:16 | GordonBGood | Araq: this last gist link has to do with a compiler crash when a closure creation is nested in another proc, only for --gc:destructors/ref counting AFAICT |
22:53:53 | GordonBGood | The compiler error message comes from lambdalifting.nim at the end of symToClosure |
22:57:00 | GordonBGood | Araq, you need to go soon and I need some more sleep; I'll check the log later for replies... gn8 |
22:57:14 | Araq | bye |
22:58:03 | * | jjido joined #nim |
23:01:15 | rayman22201 | see you! thanks for the help |
23:01:49 | * | GordonBGood quit (Ping timeout: 268 seconds) |
23:13:11 | shashlick | @disruptek - bump rocks |
23:18:09 | dom96 | yay! My game runs on iOS |
23:18:26 | dom96 | still a while to go before it renders correctly though :) |
23:20:02 | rayman22201 | 🎉 |
23:25:09 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:35:05 | shashlick | on project local deps support for Nimble - https://gist.github.com/genotrance/ee2ce321a56c95df2d4bb7ce4bd6b5ab |
23:35:08 | shashlick | appreciate feedback |
23:39:17 | dom96 | I would prefer if we have a dedicated command to initiate local deps |
23:39:24 | dom96 | for example `nimble freeze` |
23:39:34 | dom96 | instead of this "local = true" in the .nimble file |
23:39:51 | * | nxl4 joined #nim |
23:40:04 | shashlick | there's really nothing to do besides creating a directory |
23:40:18 | shashlick | but it will drive a bunch of code changes with no real benefit |
23:40:23 | shashlick | the .nimble change can be checked in |
23:40:34 | dom96 | The whole idea is to have Nimble copy the deps |
23:40:35 | Araq | Elif .nimble file for a project contains local = true, create $prj/deps and force nimbleDir = $prj/deps |
23:40:37 | shashlick | a command is equivalent to mkdir |
23:41:10 | dom96 | I don't want to change `nimble install` behaviour |
23:41:12 | Araq | ^ this is problematic as the project.nimble file describes its dependencies for other clients |
23:41:20 | dom96 | at least not for now |
23:41:33 | shashlick | nimble install isn't changing, i've described in notes |
23:41:44 | Araq | I think 'local = true' is not required. |
23:41:58 | shashlick | we can skip it, it avoids having to check in an empty txt file |
23:42:24 | shashlick | local = true will be ignored if the package is installed as a dependency itself |
23:42:32 | shashlick | it is only relevant when the package is the project itself |
23:42:39 | Araq | ok |
23:42:42 | dom96 | from what I can see in your proposal: `nimble install -d` will install into $prj/deps |
23:42:48 | Araq | nimble install URL | packagename will again install the package to ~/.nimble per usual even if the command is run in a project dir with local deps enabled. |
23:43:00 | Araq | ^ seems not intuitive |
23:43:15 | Araq | just use my deps dir please |
23:43:22 | dom96 | no |
23:43:27 | dom96 | that's valid |
23:43:43 | shashlick | but what happens if you simply do `nimble install` - does it not do anything, install the package back into its own deps dir, or use ~/.nimble |
23:43:57 | shashlick | i've still not even thought through `nimble develop` |
23:44:04 | dom96 | the behaviour of `nimble install` shouldn't change at all |
23:44:09 | dom96 | same for `nimble develop` |
23:44:39 | shashlick | so you want a new sub-command that will do this? |
23:44:45 | dom96 | yes |
23:45:06 | shashlick | then what will nimble build do |
23:45:35 | dom96 | what should change is dependency resolution. |
23:45:48 | shashlick | if you isolate this to a separate command then it isn't intuitive like Araq says |
23:46:00 | shashlick | a whole bunch of commands that continue to just use the global ~/.nimble |
23:46:18 | Araq | exactly, we have discussed this already |
23:46:21 | shashlick | if you want local deps then everything should adjust to that |
23:46:36 | Araq | yes. |
23:46:56 | shashlick | `nimble install` could just process deps and quit since there's no copying to ~/.nimble required |
23:47:00 | shashlick | that's the alternative |
23:47:01 | Araq | GordonBGood: pushed my patch |
23:47:13 | shashlick | and still intuitive that once you create a deps dir, there's nothing new to learn |
23:47:28 | dom96 | You shouldn't use `nimble install` |
23:47:32 | Araq | I was talking about 'nimble install url' |
23:48:04 | Araq | and that should install url to deps if it exists |
23:48:04 | dom96 | what you always want to do is add a dependency in your .nimble file |
23:49:08 | Araq | no, the dependency comes later. I might want to "install" a package, see if it's useful and then add the dependency to my .nimble file |
23:50:05 | shashlick | that's a good thought but again it means all commands need to adapt to local deps |
23:50:28 | FromGitter | <Willyboar> why don't you create something similar to virtualenv? |
23:50:38 | shashlick | anyway, i know it is late for you guys, get some rest and we can debate it more tomorrow |
23:50:43 | dom96 | Araq, you can add the dependency and remove it later then |
23:50:50 | shashlick | i just want to document all behaviors so that we can implement it correctly |
23:51:07 | shashlick | this is one thought process - i'm open to any as long as it is consistent |
23:51:09 | Araq | dom96: that's a super annoying setup and you know it. |
23:51:22 | * | nxl4 quit (Quit: Konversation terminated!) |
23:51:24 | Araq | nimble search keyword |
23:51:34 | Araq | nimble install let-me-see-this |
23:51:51 | Araq | your solution: edit the .nimble file already after 'nimble search'. |
23:52:13 | shashlick | note also that even packages.json and other metadata will live in `$prj/deps` - i don't think we should change any of the nimbleDir behaviors |
23:52:31 | shashlick | i've also noted bin dir concerns |
23:53:09 | Araq | if deps exists, use it. |
23:53:12 | Araq | simple. |
23:53:14 | Araq | works. |
23:53:41 | shashlick | nimterop won't be impacted since the binary is relative to currentSourcePath of nimterop nim file - that might be a solution for that but not everyone will have a bin file that is referenced in a source file |
23:54:09 | Araq | might even apply to 'nimble develop' |
23:54:22 | Araq | it's worth a try at least |
23:54:32 | Araq | but I need to sleep indeed, good night. |
23:54:47 | FromGitter | <Willyboar> good night |
23:55:14 | dom96 | This is turning into a more disruptive feature than I thought |
23:55:52 | shashlick | I have aimed to minimize the code impact |
23:56:02 | shashlick | And complexity |
23:56:19 | rayman22201 | Everything in Nim land: this seemed easy.... nope, actually super complicated :-P |
23:56:23 | shashlick | But it will affect all areas yes |
23:56:37 | shashlick | The code might be minimal or seems |
23:56:43 | dom96 | What is the aim here? Is it to replace lock files or just make it easier to develop packages? |