00:03:03 | shashlick | is it possible to get the ast at a particular point in a file |
00:03:19 | shashlick | stmt1; stmt2; xyz; stmt3 - can you get the ast at xyz point |
00:05:07 | FromDiscord_ | <juan_carlos> Check how is done here, unrelated package, related solution on the source code: https://github.com/juancarlospaco/nim-nimterlingua/blob/master/src/nimterlingua.nim#L3-L9 |
00:07:15 | * | hagna quit (Quit: Page closed) |
00:10:48 | shashlick | i think that's your answer @treeform |
00:17:20 | FromDiscord_ | <treeform> Interesting, so you are using macro to generate templtaes |
00:17:24 | FromDiscord_ | <treeform> I'll try that |
00:23:51 | * | sotrhraven quit (Quit: sotrhraven) |
00:33:27 | * | kapil____ quit (Quit: Connection closed for inactivity) |
00:37:31 | * | leorize joined #nim |
00:41:18 | * | sotrhraven joined #nim |
00:44:26 | * | rnrwashere quit (Remote host closed the connection) |
00:50:17 | * | rnrwashere joined #nim |
00:51:34 | * | rnrwashere quit (Remote host closed the connection) |
00:52:55 | * | rnrwashere joined #nim |
00:53:19 | * | ghost64 quit (Read error: Connection reset by peer) |
00:54:26 | * | ghost64 joined #nim |
01:08:17 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
01:12:43 | * | quantum2020 quit (Quit: Page closed) |
01:19:23 | * | zachk quit (Quit: night all) |
01:29:18 | * | enow quit (Quit: leaving) |
01:43:44 | FromGitter | <deech> Anyone else seeing the following error when running tests? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c637650604f233ab6fd9599] |
01:45:29 | * | ghost64 quit (Quit: See you!) |
01:46:03 | * | ghost64 joined #nim |
01:47:40 | * | seni quit (Quit: Leaving) |
01:54:40 | * | rnrwashere quit (Remote host closed the connection) |
01:54:58 | * | rnrwashere joined #nim |
02:01:40 | * | ghidra quit (Quit: Page closed) |
02:03:49 | * | sealmove joined #nim |
02:05:57 | FromGitter | <deech> Updated `devel` and I'm getting different errors now, opened an issue: https://github.com/nim-lang/Nim/issues/10657. |
02:07:44 | leorize | deech: it's normal |
02:08:07 | leorize | those tests are to ensure that the code in Nim in Action book would still be valid for the current version |
02:11:45 | FromGitter | <deech> Ok, I'll close. But I suggest there should be under a flag, eg. `-d:niminaction`. |
02:15:53 | leorize | nah, then the devs would just skip them :P |
02:16:41 | leorize | the test suite would keep running if those failed anyway, so it's not too much of a problem |
02:17:23 | FromGitter | <deech> The CI can enable it by default ... in any case not a big deal. |
02:26:32 | * | xet7 quit (Remote host closed the connection) |
02:27:02 | * | Tyresc quit (Quit: WeeChat 2.4-dev) |
02:47:12 | * | kapil____ joined #nim |
02:51:01 | FromGitter | <dawkot> does it often make sense to use `add` instead of `&` for optimization purposes only? |
02:51:21 | * | icebattle quit (Ping timeout: 258 seconds) |
02:53:54 | FromDiscord_ | <juan_carlos> add on what? |
02:54:15 | FromGitter | <dawkot> collections in general. sequences, strings |
02:54:53 | FromDiscord_ | <juan_carlos> For string & is fastest afaik, then fmt, format is slowest |
03:00:40 | * | theelous3 joined #nim |
03:02:28 | * | banc quit (Quit: Bye) |
03:08:00 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:19:04 | * | vlad1777d quit (Ping timeout: 250 seconds) |
03:20:16 | * | abm quit (Ping timeout: 246 seconds) |
03:21:50 | * | theelous3 quit (Read error: Connection reset by peer) |
03:23:31 | * | banc joined #nim |
04:04:09 | * | nsf joined #nim |
04:27:40 | * | banc quit (Ping timeout: 268 seconds) |
04:31:59 | sealmove | guys how does env nimrc work? |
04:34:36 | * | banc joined #nim |
04:42:24 | leorize | sealmove: nimrc? |
04:43:17 | sealmove | the other day someone told me you can use #!/usr/bin/env nimrc to mimic scripting while using normal Nim (instead of NimScript) |
04:43:45 | sealmove | but I that doesn't work out of the box, so I wonder how to set it up |
04:45:17 | leorize | I think they mean nimrun instead |
04:45:26 | leorize | it's a nimble package |
04:45:37 | leorize | see https://github.com/lee-b/nimrun |
05:00:09 | sealmove | Hmm, it looks very similar, but I am pretty sure "nimrc" is accurate. Thanks anyway. |
05:07:21 | * | leorize quit (Remote host closed the connection) |
05:14:00 | * | sotrhraven quit (Quit: sotrhraven) |
05:21:07 | FromDiscord_ | <Geroro / Grey Ghost> Hi all! what is the best way to make a non-blocking function? I've been reading about threads, async dispatch and spawn but I'm lost, I thought {.async.} made a function non-blocking but it doesn't? |
05:25:21 | rayman22201 | what do you mean by non-blocking? |
05:26:13 | * | dddddd quit (Remote host closed the connection) |
05:27:01 | rayman22201 | or a better question, what are you trying to accomplish? maybe we can help you figure out the right feature for the job. |
05:28:15 | FromDiscord_ | <Geroro / Grey Ghost> Thank you, I'm working on an game using sdl, I want to hot reload images but the game pauses while it reloads the image |
05:29:35 | FromDiscord_ | <Geroro / Grey Ghost> I'm new to nim, loving it so far, blew threw all the basics and am completely lost now lol |
05:30:01 | rayman22201 | Always glad to have more people try the language :-) |
05:30:38 | rayman22201 | what sdl bindings are you using? |
05:31:22 | FromDiscord_ | <Geroro / Grey Ghost> its a nice language :) nim-lang/sdl2 |
05:31:22 | rayman22201 | ah. ok. {.async.} should help you here. But the library you are using might not be playing nice with async |
05:32:18 | FromDiscord_ | <Geroro / Grey Ghost> and sdl2/image |
05:32:47 | * | disruptek quit (Quit: Bye) |
05:38:06 | rayman22201 | does sdl2 let you do non-blocking calls in general? |
05:38:56 | rayman22201 | I'm not super familiar with sdl2, but I don't see anything in the docs for sdl2 about non-blocking io |
05:40:21 | FromDiscord_ | <Geroro / Grey Ghost> I don't believe it does, I think I need to use a second thread? was thinking nim was going to do some thread magic with {.async.} |
05:40:45 | rayman22201 | async != threads |
05:41:33 | rayman22201 | async is like promises from javascript. Still single threaded, just lets you do other things in the thread while you wait for IO to finish. |
05:42:02 | rayman22201 | but the IO has to support non-blocking IO for that to work |
05:42:59 | FromDiscord_ | <Geroro / Grey Ghost> ah ok, I will keep working at it, I don't mean to take all your time, thank you! I appreciate your help |
05:43:20 | rayman22201 | If you want to use threads, that's a totally different thing. You would use spawn or create_thread yourself. |
05:43:28 | rayman22201 | No worries. I don't mind helping. |
05:44:17 | rayman22201 | if gets you to stick with Nim anyway :-P |
05:44:36 | FromDiscord_ | <Geroro / Grey Ghost> I was checking out spawn but my code isn't gcsafe, I don't think I understand threads and the gc in nim enough yet, I'll keep reading xD Thanks! |
05:46:59 | rayman22201 | lol. Yeah. Nim has a very unique way of dealing with threads and GC. |
05:49:33 | rayman22201 | this is good reading for threads: https://nim-lang.github.io/Nim/manual.html#threads |
05:52:52 | rayman22201 | And this article is really helpful for understanding the GC: https://peterme.net/nim-types-originally-a-reddit-reply.html |
05:54:07 | * | rnrwashere quit (Remote host closed the connection) |
05:54:40 | * | rnrwashere joined #nim |
05:57:53 | FromDiscord_ | <Geroro / Grey Ghost> it does! thank you! reading now |
06:23:13 | * | narimiran joined #nim |
06:26:08 | * | sealmove quit (Quit: WeeChat 2.3) |
06:28:12 | * | leorize joined #nim |
06:36:26 | * | rnrwashere quit (Remote host closed the connection) |
06:59:38 | * | krux02 joined #nim |
07:00:06 | * | drazan joined #nim |
07:11:14 | FromGitter | <mratsim> @Geroro / Grey Ghost, for non-blocking IO you should use async |
07:11:53 | FromGitter | <mratsim> (except for stdin there is no way even in C to not block a thread on stdin) |
07:15:02 | * | oprypin quit (Quit: No Ping reply in 180 seconds.) |
07:25:02 | Zevv | no *portable* way |
07:26:49 | * | vlad1777d joined #nim |
07:28:41 | * | disruptek joined #nim |
07:44:59 | * | disruptek quit (Ping timeout: 258 seconds) |
07:47:49 | * | disruptek joined #nim |
07:48:21 | narimiran | @zacharycarter you here? |
07:51:35 | * | AndreasO joined #nim |
07:54:12 | * | AndreasO quit (Remote host closed the connection) |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:04:49 | * | gmpreussner joined #nim |
08:11:09 | narimiran | @brentp you here? |
08:17:58 | FromGitter | <mratsim> the kind of cool stuff that should be in a wiki/cookbook: https://forum.nim-lang.org/t/4632 |
08:21:03 | * | PMunch joined #nim |
08:22:14 | FromGitter | <mratsim> maybe with a staging/open question - for example this: https://github.com/nim-lang/Nim/issues/10661 |
08:22:25 | FromGitter | <mratsim> staging section* |
08:27:27 | PMunch | Writing Python makes me miss Nim :( |
08:27:47 | PMunch | It feels about the same, but I miss my types |
08:28:03 | PMunch | And 4-wide tabs now feels so wasteful :P |
08:29:31 | narimiran | PMunch: google used 2-space indentation in python |
08:29:45 | PMunch | Does that work? |
08:29:53 | PMunch | I thought it had to be 4 spaces or tabs |
08:30:59 | narimiran | haha, you can have any amount of spaces, but it must be consistent |
08:38:58 | FromGitter | <mratsim> you can configure the default spacing for your editor |
08:39:28 | FromGitter | <mratsim> for types, you can "import typing" and for type checking you have to call "mypy" on your Python program |
08:41:18 | narimiran | +1 for `import typing` and `mypy` - this was my nim before i discovered nim :) |
08:46:13 | * | neceve joined #nim |
08:51:17 | narimiran | you can set it up that mypy is called on every file save |
08:51:40 | * | neceve quit (Read error: Connection reset by peer) |
08:54:03 | * | mal`` quit (Quit: Leaving) |
08:58:56 | * | mal`` joined #nim |
09:03:52 | * | floppydh joined #nim |
09:06:43 | * | mal`` quit (Quit: Leaving) |
09:16:56 | * | Jjp137 quit (Quit: Leaving) |
09:17:44 | * | mal`` joined #nim |
09:18:23 | * | JustASlacker joined #nim |
09:19:12 | * | Jjp137 joined #nim |
09:20:28 | * | Vladar joined #nim |
09:24:49 | * | KindOne joined #nim |
09:51:04 | * | stefanos82 joined #nim |
09:51:58 | * | abm joined #nim |
09:57:56 | FromGitter | <Bennyelg> does Nim support tail recursion ? |
09:59:16 | * | vlad1777d quit (Remote host closed the connection) |
10:00:36 | Araq | nope, the underlying C/C++ code support it but don't rely on it |
10:00:44 | Araq | nope, the underlying C/C++ compilers support it but don't rely on it |
10:01:01 | FromGitter | <Bennyelg> @Araq thanks. |
10:02:14 | * | vlad1777d joined #nim |
10:06:37 | * | rayman22201 quit (Quit: Connection closed for inactivity) |
10:06:51 | FromGitter | <mratsim> see: https://forum.nim-lang.org/t/3931 |
10:10:01 | FromGitter | <mratsim> but if you are trying to do something functional style, you might have better luck with "it" templates (anamorphic templates) |
10:11:49 | narimiran | quick question, because i always forget (confuse the two of them): what to replace `stmt` with, and what `expr` with? |
10:12:01 | leorize | stmt = typed and expr = untyped iirc |
10:13:14 | * | ghost64 quit (Read error: Connection reset by peer) |
10:19:14 | * | ghost64 joined #nim |
10:29:02 | * | dom96_w joined #nim |
10:37:59 | narimiran | thanks leorize |
10:41:10 | FromGitter | <mratsim> no |
10:41:14 | FromGitter | <mratsim> it's the inverse |
10:41:20 | narimiran | haha |
10:41:27 | narimiran | now you see why i'm confused |
10:41:30 | FromGitter | <mratsim> a statement is supposed to have a void type |
10:41:57 | FromGitter | <mratsim> also when you use a macro with newStmtList() it returns untyped usually |
10:42:14 | FromGitter | <mratsim> an expression is typed (int, string ...) |
10:42:29 | * | solitudesf quit (Read error: Connection reset by peer) |
10:45:20 | FromGitter | <mratsim> but basically untyped means you want an AST tree that hasn't pass semcheck |
10:45:45 | FromGitter | <mratsim> so you can use it for both expr and stmt |
10:47:06 | * | solitudesf joined #nim |
10:50:04 | narimiran | thanks @mratsim, i've written down what you've said, hopefully there will be no future confusions |
10:50:34 | Araq | watch out that ': stmt' as a template return type should become '' (not return type) |
11:16:19 | * | Vladar quit (Remote host closed the connection) |
11:32:10 | * | dom96_w quit (Quit: Textual IRC Client: www.textualapp.com) |
11:36:13 | * | absolutejam joined #nim |
11:42:03 | * | dom96_w joined #nim |
11:56:27 | * | smitop joined #nim |
12:15:14 | * | dddddd joined #nim |
12:23:06 | * | sotrhraven joined #nim |
12:30:12 | * | ng0 joined #nim |
12:30:25 | narimiran | dom96, dom96_w: is there a reason why nimforum is not available as nimble package? (can i add it?) |
12:42:51 | dom96_w | I guess |
12:43:08 | dom96_w | it won't work though |
12:43:13 | dom96_w | so actually no |
12:43:29 | dom96_w | Nimforum needs files which it won't be able to find if it's installed by Nimble |
12:45:59 | narimiran | ok, then we can't test it against devel |
12:56:12 | * | couven92 joined #nim |
13:02:04 | * | nsf quit (Quit: WeeChat 2.3) |
13:03:16 | * | Snircle joined #nim |
13:16:40 | FromGitter | <mratsim> btw, will we have seq/strings destructors in 0.20? |
13:48:42 | * | Vladar joined #nim |
14:09:42 | FromGitter | <brentp> @narimiran what's up? |
14:10:23 | narimiran | @brentp same question as for dom above: is there any reason why mosdepth is not available as nimble package? |
14:11:14 | FromGitter | <brentp> it was my first nim program.... and not very useful as a package. |
14:12:17 | narimiran | it has a lot of github stars :) |
14:12:35 | * | seni joined #nim |
14:12:50 | narimiran | based on that, i wanted to include it in our tests to see if devel breaks popular nim packages |
14:14:15 | FromGitter | <brentp> yeah. it's getting used a lot. you could use https://github.com/brentp/hts-nim/ instead as that's the backend and available in nimble (though has a lot of deps for install -- curl, crypto, lzma, etc) |
14:14:42 | narimiran | yeah, i already included `hts` :) |
14:15:19 | FromGitter | <brentp> great. where are you doing this? |
14:16:54 | narimiran | in my branch. still some problems with CI. it will be merged once it works ok |
14:24:28 | * | Perkol joined #nim |
14:25:27 | Perkol | I'm trying to use nim with vscode but get error:No 'nim' binary could be found in PATH: '/app/bin:/usr/bin' |
14:26:06 | Perkol | Even through nim installed and have executable in /usr/bin/nim |
14:26:23 | narimiran | Perkol: "have you tried turning it off and on again?" |
14:26:48 | Perkol | vscode? yes |
14:30:19 | narimiran | `nim -v` works in your terminal? |
14:31:08 | Perkol | Hm, disabled enabled plugin, now works |
14:31:48 | narimiran | hehe, "have you tried turning it off and on again?" wins once again :D |
14:33:05 | FromGitter | <brentp> @narimiran if it will help, I'll make mosdepth a nimble package. |
14:33:46 | narimiran | @brentp up to you. if you say it is not importand and/or it is enough to test `hts`, then it doesn't matter |
14:37:16 | FromGitter | <brentp> `hts` probably sufficient. |
14:38:32 | * | dddddd quit (Ping timeout: 250 seconds) |
15:06:12 | * | kapil____ quit (Quit: Connection closed for inactivity) |
15:10:24 | * | JustASlacker quit (Remote host closed the connection) |
15:10:54 | * | PMunch quit (Remote host closed the connection) |
15:14:24 | * | aguspiza joined #nim |
15:16:22 | * | cyraxjoe quit (Ping timeout: 246 seconds) |
15:16:43 | * | cyraxjoe joined #nim |
15:52:52 | * | Perkol quit (Quit: Leaving) |
16:07:12 | * | icebattle joined #nim |
16:12:00 | FromGitter | <Bennyelg> HATE the BA's that run SELECT * FROM table on analytical Database without any reasons from various tables on the same time. |
16:12:10 | FromGitter | <Bennyelg> can we kill those ;) |
16:13:50 | * | rnrwashere joined #nim |
16:23:52 | narimiran | https://twitter.com/termux/status/1094034731065315328 |
16:34:18 | * | floppydh quit (Quit: WeeChat 2.3) |
16:37:30 | * | vlad1777d quit (Ping timeout: 244 seconds) |
16:39:18 | * | Trustable joined #nim |
16:39:28 | FromGitter | <Varriount> @Bennyelg If you're using Postures, you could write a hook that does query rewriting |
16:39:45 | FromGitter | <Varriount> *postgres |
16:47:37 | * | rnrwashere quit (Remote host closed the connection) |
16:47:53 | * | rnrwashere joined #nim |
16:59:49 | * | nsf joined #nim |
17:08:34 | smitop | How do I use the [] operator on a pointer |
17:08:42 | smitop | As I can do with C/C++ |
17:09:00 | dom96_w | cast it to an array |
17:10:38 | Araq | cast it to 'ptr UncheckedArray' |
17:11:18 | FromGitter | <mratsim> cast it away =) |
17:12:02 | leorize | is there any use case for `UncheckedArray` without `ptr`? |
17:12:44 | FromGitter | <mratsim> I think it's not allowed anymore |
17:13:11 | FromGitter | <mratsim> but you can have an object wrapping len + UncheckedArray |
17:13:17 | FromGitter | <mratsim> and only usable by pointer |
17:17:09 | * | tun3 joined #nim |
17:17:15 | * | tun3 left #nim (#nim) |
17:18:19 | * | rnrwashere quit (Remote host closed the connection) |
17:18:45 | * | rnrwashere joined #nim |
17:19:16 | narimiran | btw, cast section in the manual needs some love: https://nim-lang.github.io/Nim/manual.html#statements-and-expressions-type-casts |
17:19:36 | * | narimiran waits incoming "so fix it" |
17:20:57 | narimiran | but seriously, somebody who uses `cast` relatively frequently could write it better than me. just a small paragraph with an illustrating example or two |
17:22:47 | FromGitter | <Bennyelg> @Varriount unfortunately postgres is not olap its oltp |
17:23:13 | FromGitter | <Bennyelg> but can you elaborate about the query rewrite? |
17:32:14 | FromDiscord_ | <juan_carlos> I have the feeling that a cool Docs/Tutorial/blog/etc is needed to understand subex, pegs, sexp because they look like kinda useful modules for string processing, but I dont really understand how to use them. :| |
17:33:36 | * | icebattle quit (Remote host closed the connection) |
17:36:19 | * | rayman22201 joined #nim |
17:40:05 | * | rnrwashere quit (Remote host closed the connection) |
17:42:16 | * | rnrwashere joined #nim |
17:44:25 | * | rnrwashere quit (Remote host closed the connection) |
17:44:58 | * | rnrwashere joined #nim |
17:46:09 | * | rnrwashere quit (Remote host closed the connection) |
17:47:08 | * | rnrwashere joined #nim |
17:47:42 | * | zachk joined #nim |
17:49:47 | * | rnrwashere quit (Remote host closed the connection) |
17:55:05 | FromDiscord_ | <juan_carlos> Python is adding its own ./node_modules/ named ./__pypackages__/ 🤔🤔🤔 |
17:56:11 | FromDiscord_ | <juan_carlos> You can always add more stuffs intead of fixing the existent ones with yet another way to install packages. |
17:57:28 | FromGitter | <mratsim> fixing can break others while adding will not |
17:58:07 | FromGitter | <mratsim> I think that's closely related to the second law of thermodynamics, entropy (the measure of chaos) can only rise. |
17:58:32 | FromDiscord_ | <juan_carlos> They recently breaking C API and Regex. Not counting 2 to 3 thingy. |
17:59:22 | FromDiscord_ | <juan_carlos> Anyways, I made some examples of Assembly on Nim https://github.com/juancarlospaco/nim-presentation-slides/tree/master/ejemplos/avanzado/assembly |
17:59:40 | FromDiscord_ | <juan_carlos> I cant remove the asmNoStackFrame tho, it wont compile without that. |
18:00:27 | FromGitter | <mratsim> why don't you create proper functions? |
18:01:03 | FromDiscord_ | <juan_carlos> They are functions (?) |
18:01:22 | FromGitter | <mratsim> you cannot pass parameters to them |
18:01:28 | FromDiscord_ | <juan_carlos> They are just examples :P hehehe |
18:01:50 | FromDiscord_ | <juan_carlos> `arg` wont work, try one and youll see. :( |
18:02:02 | FromDiscord_ | <juan_carlos> the `` thing |
18:02:08 | FromGitter | <mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c645ba0ef98455ea42d62e9] |
18:02:55 | narimiran | :mratsim mic-drops: |
18:04:00 | FromGitter | <genotrance> how do you pass data around in a generic way without casting |
18:04:01 | FromDiscord_ | <juan_carlos> I know, also Ive seen std lib, but I dont know how it works, std lib puts values without the `` |
18:06:00 | FromGitter | <mratsim> `` is interpolation |
18:06:18 | FromGitter | <mratsim> I'm not sure how to do it with intel syntax unfortunately |
18:06:34 | FromGitter | <mratsim> basically you have to look into the registers used by your function |
18:06:40 | * | rnrwashere joined #nim |
18:07:00 | FromGitter | <mratsim> for example: https://www.felixcloutier.com/x86/mul |
18:07:14 | FromGitter | <mratsim> source: RAX and R/M, destination RAX |
18:08:00 | FromGitter | <mratsim> sorry RDX (high word) and RAX (low word) |
18:08:18 | FromDiscord_ | <juan_carlos> I want something thats like a string formatting before passing it to asm statement, maybe Ill create a macro later. |
18:08:23 | FromGitter | <mratsim> so RDX and RAX need to be passed as var or be a result tuple |
18:09:21 | * | rnrwashere quit (Remote host closed the connection) |
18:09:21 | FromGitter | <mratsim> i.e. if you give me the signature you want for your op, I can update the examples |
18:10:03 | FromGitter | <mratsim> @genotrance [T]? |
18:10:56 | FromDiscord_ | <juan_carlos> "a in eax, and b in edx", how it does it without the `` I dont get it, Doc says thats whats `` is for https://github.com/nim-lang/Nim/blob/master/lib/system/arithm.nim#L168 |
18:11:21 | shashlick | @mratsim - think more in terms of using the same channel to pass different data types thru it |
18:11:36 | shashlick | So the channel is agnostic, the endpoints know that to do |
18:12:38 | FromGitter | <mratsim> and type is known at runtime or compile time? |
18:13:34 | FromGitter | <jivank> do any of you have thoughts on this? https://github.com/nim-lang/Nim/issues/10661 . i was thinking a callback function being passed down but i wonder if there is a cleaner way |
18:15:39 | * | rnrwashere joined #nim |
18:16:58 | FromGitter | <mratsim> @juancarlospaco: no idea here, seems like a and b are passed via ecx and edx. |
18:18:12 | FromGitter | <mratsim> afaik those are the registers used in _fastcall calling convention |
18:18:20 | * | rnrwashere quit (Remote host closed the connection) |
18:18:40 | shashlick | @mratsim: i'd say known, but across dlls |
18:19:45 | FromGitter | <mratsim> you will need an instantiated proc for each concrete type with a different name then. |
18:20:07 | * | vendethiel- joined #nim |
18:20:11 | shashlick | or resort to pointers |
18:20:30 | * | rnrwashere joined #nim |
18:20:49 | shashlick | its the channel that's defined with a particular type |
18:21:14 | shashlick | am just wondering how queues, msg busses etc, handle this generic problem |
18:21:23 | FromGitter | <mratsim> @jivank, that may be more suited for the forum |
18:21:50 | FromGitter | <mratsim> @shashlick wire serialization |
18:23:34 | shashlick | ya that will be too slow since this is in the same process, same thread |
18:23:43 | shashlick | will have to look for something else |
18:28:02 | * | TheLemonMan joined #nim |
18:28:25 | TheLemonMan | jivank, what about streams? |
18:30:29 | TheLemonMan | jesus, appvoyeur keeps timing out |
18:30:52 | TheLemonMan | maybe the package test pipeline can be moved to Azure CI or something else |
18:31:40 | FromDiscord_ | <juan_carlos> Wont Travis support all OS now?. I didnt try tho... |
18:32:01 | narimiran | we have problems with travis too |
18:32:22 | TheLemonMan | making Travis even slower than it already is is not a solution |
18:32:30 | FromDiscord_ | <juan_carlos> hahaha Oh My Gauss :( |
18:33:08 | narimiran | azure pipelines should supposedly be much faster, but that PR never delivered.... |
18:33:50 | FromGitter | <mratsim> we have the same issue in Status |
18:33:54 | FromGitter | <mratsim> 2 hours for Appveyor |
18:33:55 | FromGitter | <iffy> How could I print out N bytes of memory starting at `pointer`? |
18:34:34 | TheLemonMan | we just have to summon Timothee to fix that :D |
18:35:09 | * | FromGitter * mratsim Summon Elemental IX |
18:36:22 | FromGitter | <mratsim> @iffy I'm pretty sure I had a dumpMem function somewhere but I can't find it |
18:36:55 | * | vendethiel- quit (Ping timeout: 246 seconds) |
18:37:11 | TheLemonMan | iffy: for i in 0 .. N: echo cast[ptr UncheckedArray[byte]](myPointer)[i] |
18:37:22 | FromGitter | <mratsim> the quick hack is to cast to array[N, byte] |
18:37:36 | FromGitter | <mratsim> ptr array* and then dereference |
18:37:37 | * | vendethiel- joined #nim |
18:37:46 | FromGitter | <iffy> okay, let me try those |
18:37:55 | FromGitter | <mratsim> feel free to use byteutils if you want hex display: https://github.com/status-im/nim-byteutils/blob/master/byteutils.nim |
18:41:07 | * | Jesin quit (Quit: Leaving) |
18:43:16 | * | Jesin joined #nim |
18:47:14 | FromGitter | <Varriount> PMunch: Python3.5+ has type annotations. |
18:47:20 | * | xet7 joined #nim |
18:48:54 | * | rnrwashere quit (Remote host closed the connection) |
18:49:54 | * | rnrwashere joined #nim |
18:59:21 | * | rockcavera quit (Remote host closed the connection) |
19:00:24 | FromGitter | <iffy> @mratsim and @TheLemonMan thank you for your help. Here's what I ended up with: https://gist.github.com/iffy/a961cdd7625a54e6b179aa2f0d200b54 |
19:01:42 | TheLemonMan | noice |
19:05:27 | * | dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:08:18 | * | NimBot joined #nim |
19:08:28 | * | Cthalupa quit (Ping timeout: 258 seconds) |
19:08:50 | * | dorelix joined #nim |
19:10:48 | * | Cthalupa joined #nim |
19:19:09 | * | Perkol joined #nim |
19:19:33 | * | rockcavera joined #nim |
19:31:09 | * | rnrwashere quit (Remote host closed the connection) |
19:31:22 | * | rnrwashere joined #nim |
19:33:27 | * | elrood joined #nim |
19:35:56 | * | nsf quit (Quit: WeeChat 2.3) |
19:39:22 | FromGitter | <jivank> TheLemonMan: maybe just have the body be written directly to disk and return a stream (from disk) back |
19:39:37 | FromGitter | <iffy> Am I doing anything obviously wrong with memory in this snippet of code? https://gist.github.com/iffy/c31198e66fe51f8dcaf6c4289fab8f43 At some point through the loop, portions of the thing I'm iterating over get changed, but I don't think I'm changing them. |
19:42:30 | FromGitter | <iffy> Specifically, the first string of `res.rows[5]` changes from `"5"` to `"\0\0\0\0"` |
19:43:08 | TheLemonMan | jivank, that'd be extremely inefficient |
19:45:55 | FromGitter | <iffy> I'm using `--gc:markAndSweep` if that makes a difference |
19:46:39 | FromGitter | <jivank> TheLemonMan: in what way? |
19:48:14 | FromGitter | <jivank> it seems werkzeug is doing something like that https://github.com/pallets/werkzeug/blob/master/werkzeug/formparser.py#L45 |
19:49:52 | TheLemonMan | I'm no http server expert but that sounds incredibly wasteful to me, IO is not free |
19:51:20 | FromGitter | <jivank> i guess more reason to let the user handle the socket |
19:52:10 | * | vendethiel- quit (Ping timeout: 272 seconds) |
19:56:21 | FromGitter | <iffy> I'm trying to make absolutely sure that neither my Nim code nor Nim itself is messing up memory arbitrarily. None of the procs I'm using (newJArray, newJString, startsWith, add) should mutate data in res.rows, right? |
19:56:38 | TheLemonMan | hopefully |
19:57:57 | FromGitter | <iffy> *something* that's running during that loop is messing up memory. How can I make sure it's not Nim? |
20:00:52 | TheLemonMan | what else is running? |
20:01:01 | FromGitter | <iffy> Node.js |
20:01:24 | TheLemonMan | eh |
20:10:00 | shashlick | how can i get to the stack trace of a crashed dll call (nim dll) |
20:10:18 | shashlick | i can catch the crash exception but don't get any exception message in the trace |
20:15:36 | FromGitter | <iffy> @TheLemonMan so it's either the `json` module, how I'm iterating through `AllResult` *or* Node.js. My gut says it's Node.js, but I want to be sure it's not the Nim stuff. |
20:25:20 | TheLemonMan | well if you're not doing anything unsafe (casts & addr for example) you can rule that out |
20:30:35 | FromGitter | <iffy> that's what I thought. json doesn't use cast/addr from what I can see; neither does iterating; neither does my code. *AND* I just learned that Node *does* use threads, so I suspect it's a threading problem |
20:32:47 | * | vendethiel- joined #nim |
20:38:25 | * | rnrwashere quit (Remote host closed the connection) |
20:41:10 | * | Trustable quit (Remote host closed the connection) |
20:42:55 | * | dddddd joined #nim |
20:43:27 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
20:52:54 | * | elrood quit (Remote host closed the connection) |
20:56:15 | * | caffa joined #nim |
20:56:45 | caffa | sorry wrong channel |
20:56:49 | * | caffa quit (Client Quit) |
20:57:42 | FromGitter | <skellock> apology accepted |
21:09:36 | * | Tyresc joined #nim |
21:11:03 | FromGitter | <iffy> Why does this show 2 different addresses for `res.rows[5][0]`? |
21:11:16 | FromGitter | <iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c6487f45095f6660cebee71] |
21:11:30 | FromGitter | <iffy> output: |
21:11:36 | FromGitter | <iffy> ```res.rows[5][0]: 0x107ac1800"5" ⏎ addr: 0000000107A87DC8``` [https://gitter.im/nim-lang/Nim?at=5c648808126af75deb9fc6d6] |
21:12:12 | * | aguspiza quit (Ping timeout: 246 seconds) |
21:15:17 | * | smitop quit (Quit: Connection closed for inactivity) |
21:20:40 | * | rnrwashere joined #nim |
21:23:15 | * | Perkol quit (Quit: Leaving) |
21:25:00 | * | rnrwashere quit (Ping timeout: 250 seconds) |
21:25:46 | * | rnrwashere joined #nim |
21:30:19 | rayman22201 | I'm not sure, but shouldn't you cast a pointer to a uint64? |
21:30:41 | rayman22201 | assuming you are on a 64bit machine |
21:32:59 | FromGitter | <iffy> same thing with uint64 |
21:33:10 | FromGitter | <iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c648d15ef98455ea42ee1c8] |
21:33:10 | rayman22201 | what type is rows? |
21:33:19 | FromGitter | <iffy> I made a simpler example ^ |
21:33:26 | FromGitter | <iffy> ```0x106e83058"something" ⏎ 0000000106E3BB48``` [https://gitter.im/nim-lang/Nim?at=5c648d25126af75deb9fee97] |
21:34:49 | rayman22201 | yeah, repr copies strings. try `repr(res.rows[5][0].unsafeAddr)` |
21:35:14 | FromGitter | <iffy> it copies strings!? |
21:35:20 | FromGitter | <iffy> I trusted you, repr! |
21:35:37 | rayman22201 | lol. Here is the compiler source code for repr: https://github.com/nim-lang/Nim/blob/3f6168b3372013c0d4b938e6a83849199d9756c9/lib/system/repr.nim#L18 |
21:36:10 | rayman22201 | all the gory details :-P |
21:36:34 | * | Vladar quit (Remote host closed the connection) |
21:37:24 | FromGitter | <iffy> ```0x101f0f058"something" ⏎ 0000000101EC7B88 ⏎ ref 0x101ec7b88 --> 0x101f0f058"something"``` [https://gitter.im/nim-lang/Nim?at=5c648e14dc3f0523ccae6e01] |
21:37:35 | * | rnrwashere quit (Remote host closed the connection) |
21:37:45 | FromGitter | <iffy> so... wait, okay, yes it's a ref to where the string actually si |
21:38:24 | rayman22201 | boom. there you go :D |
21:38:38 | Araq | repr doesn't copy the string |
21:38:48 | FromGitter | <iffy> yes, thank heavens |
21:39:18 | rayman22201 | I thought it did for some reason. cool. good to be wrong about some things |
21:40:25 | * | vlad1777d joined #nim |
21:40:33 | FromGitter | <iffy> So... how can I do that dereferencing myself to get a pointer = 0x101f0f058? |
21:43:39 | FromGitter | <iffy> looks like `castpointer (mystring)` does that |
21:45:35 | FromGitter | <iffy> errr... no, that points to a spot before the real place in memory |
21:45:53 | rayman22201 | I'm not familiar with that function |
21:46:47 | rayman22201 | addr(mystring) maybe? |
21:47:21 | FromGitter | <iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c649069dc3f0523ccae7d86] |
21:47:46 | * | rnrwashere joined #nim |
21:48:17 | * | rnrwashere quit (Remote host closed the connection) |
21:48:47 | FromGitter | <iffy> addr(mystring) returns the same as unsafeAddr(mystring) |
21:49:01 | rayman22201 | oh.... `cast[ptr]` the formatting screwed up on my irc client and I didn't see it correctly. |
21:49:13 | * | narimiran quit (Ping timeout: 245 seconds) |
21:51:45 | krux02 | @iffy: addr and unsafeAddr is supposed to return the same value |
21:52:03 | FromGitter | <iffy> right |
21:53:12 | krux02 | I didn't follow the entire conversation, what do you want to do with this addr of a string? |
21:54:01 | FromGitter | <iffy> I have an annoying memory bug -- I'm just trying to be able to print out memory at parts in my program and I've been using the wrong addresses for my strings. Finally got it: |
21:54:08 | FromGitter | <iffy> `toHex(castuint64 (cast[pointer](s[0].addr)))` |
21:54:24 | krux02 | ah |
21:54:32 | krux02 | yea strings are a bit special |
21:55:09 | krux02 | you better go via cstring |
21:55:22 | rayman22201 | I'm looking at what repr does. convert it to a cstring maybe? `toHex(cast[uint64](cstring(s).unsafeaddr))` |
21:55:52 | krux02 | cstring(s) is basically `cast[ptr char](s[0].addr)` |
21:56:34 | krux02 | so toHex(cast[uint64](cstring(s))) is what you really want |
21:56:44 | rayman22201 | 👍 |
21:56:56 | krux02 | I don't have that emoji |
21:57:15 | rayman22201 | lol, does it show up as a box? It's jut a thumbs up like github |
21:57:42 | krux02 | it's some hex values in a box |
21:58:34 | krux02 | the cstring variant is really what you should do, as s[0] might crash with a segfault on empty strings. |
21:58:39 | FromGitter | <iffy> perfect, that's much shorter (the cstring() method) |
21:59:53 | krux02 | repr is an old feature of nim that was supposed to be the default debugging swiss army knife that works for everything. |
22:01:03 | krux02 | But it uses RTTI, which is bad. Didn't get any love for a very long time. Doesn't properly support custom overloding ( `$` operator does), is longer than `$` |
22:01:12 | FromGitter | <iffy> So if a string has a value of "5", would you expect memory at cstring(mystring) to be a single byte 0x35 (decimal 53 -- an unfortunate palindrome) |
22:01:25 | krux02 | by now the `$` operator took over the `repr` function for almost everything |
22:01:33 | krux02 | except NimNode printing |
22:02:46 | krux02 | well I would assume this: ``cstring("5")[] == '5'`` |
22:04:16 | krux02 | @iffy, so if you mean that, then yes |
22:04:34 | FromGitter | <iffy> Okay yes, `var s = "5"; echo castbyte (cstring(s)[0])` prints out "53" but in my program |
22:05:01 | krux02 | no that is wrang |
22:05:10 | krux02 | don't cast a pointer type to a byte |
22:05:31 | FromGitter | <iffy> how come? |
22:05:57 | krux02 | oh, sorry |
22:06:06 | krux02 | didn't see the [] |
22:06:18 | FromGitter | <iffy> yeah, this markdown thing gets in the way a bit |
22:06:40 | krux02 | this time it was my bad |
22:07:35 | FromGitter | <iffy> krux02: this is the problem I'm trying to solve: https://gist.github.com/iffy/c31198e66fe51f8dcaf6c4289fab8f43 |
22:08:16 | krux02 | the difference is s[0] might crash on empty string, cstring(s)[0] may not crash, on empty string it is definde to return a 0 byte |
22:09:37 | krux02 | @iffy: I don't get the problem in that gist |
22:12:10 | krux02 | @iffy you print several times the exact same date: ``res.rows[5].repr`` |
22:12:28 | FromGitter | <iffy> And yet it's different after the first time |
22:12:45 | FromGitter | <iffy> (see output.txt line 5 vs line 2) |
22:14:05 | krux02 | that should not happen |
22:14:13 | krux02 | but I can't reproduce here |
22:14:19 | krux02 | did you try to not use repr? |
22:14:20 | FromGitter | <iffy> That's what I need to hear. |
22:14:48 | FromGitter | <iffy> This is being run as a Node.JS addon; so I suspect Node is messing things up |
22:15:15 | FromGitter | <iffy> changing what I echo changes whether/how the bug manifests |
22:16:20 | * | rnrwashere joined #nim |
22:17:08 | * | vendethiel- quit (Ping timeout: 245 seconds) |
22:20:34 | * | rnrwashere quit (Ping timeout: 246 seconds) |
22:24:12 | krux02 | @iffy, to be able to do something about it, the problem needs to be reproducable (create an issue). It also helps to dig throguh the generated code, often you can spot there when something is generated that should not be there. |
22:24:28 | Araq | lol, really? |
22:24:46 | krux02 | ? |
22:24:52 | Araq | I think looking at the generated code is counter-productive for most people |
22:25:02 | krux02 | well not for me |
22:25:36 | krux02 | it's a mess when line information is enabled. but on release mode it is quite readable |
22:25:52 | krux02 | it is not too far away from the original Nim code. |
22:26:29 | krux02 | but sure you need to be able to spot the error in the generated code. |
22:32:46 | * | redlegion quit (Remote host closed the connection) |
22:33:02 | * | ikan-keli_ quit (Quit: ZNC 1.8.x-git-125-e415d9f5 - https://znc.in) |
22:33:20 | * | ikan-keli_ joined #nim |
22:34:04 | * | redlegion joined #nim |
22:34:06 | * | redlegion quit (Changing host) |
22:34:06 | * | redlegion joined #nim |
22:35:18 | FromGitter | <Varriount> It would be nice if I could run Nim's generated code through a semi-preprocessor, to get rid of the macros and typedefs |
22:37:57 | FromGitter | <iffy> I |
22:38:22 | FromGitter | <iffy> 've tried getting something reproducible, but the problem too often goes away when I shrink the code |
22:38:47 | FromGitter | <iffy> But I'll keep trying to get it reproducible |
22:40:10 | FromGitter | <iffy> rather -- shareable and smaller (it's definitely reproducible for me :) ) |
22:40:50 | shashlick | Those gdb videos are helping me with my crashing dlls |
22:41:05 | shashlick | But would be nice to just get a stack trace |
22:42:18 | rayman22201 | @Varriount you could do `gcc -E`, but I have a feeling that would be worse not better lol |
22:42:44 | Araq | beside NIM_CALL it doesn't use macros |
22:44:36 | * | ryukoposting joined #nim |
22:46:06 | rayman22201 | @shashlick, does `--stackTrace:on` not work in a dll? |
22:47:58 | ryukoposting | super-rough first attempt at making a screencast, pls give advice http://ryuk.ooo/cut0.mp4 it's an intro to nim iterators |
22:49:55 | * | stefanos82 quit (Remote host closed the connection) |
22:51:42 | dom96 | oooh |
22:52:28 | ryukoposting | I'm planning to do the entire thing again, I think I can do better now that I've actually done it |
22:52:46 | ryukoposting | but any advice would be fantastic |
22:52:52 | dom96 | Nice editing so far and very clear narration |
22:52:58 | ryukoposting | ty :) |
22:53:46 | shashlick | rayman22201: I'll try |
22:54:02 | ryukoposting | i3wm was made for this kind of video, all the switching between terminal and editor is just me switching desktops |
22:54:35 | shashlick | I have --debugger:native and also tried --lineInfo |
22:56:40 | rayman22201 | I think those are both related to gdb. They don't really do anything for producing a stack trace directly |
22:56:54 | FromGitter | <bung87> why `compileProject ` very slow? |
22:57:40 | dom96 | ryukoposting: Yeah, not criticism so far. Very clear and completely correct explanations :) |
22:57:42 | dom96 | *no |
22:58:12 | dom96 | I would release it as-is and start work on the next video :D |
22:58:47 | ryukoposting | I cut out a ton of stuff where I'm just rambling, I'm gonna try to stay on-script a bit more next time |
23:05:51 | shashlick | rayman22201 - no luck |
23:06:07 | shashlick | unless i need to -f for it to work |
23:07:56 | rayman22201 | `-f` ? |
23:08:24 | shashlick | force nim to recompile everything |
23:08:34 | rayman22201 | oh I see |
23:08:38 | rayman22201 | idk |
23:17:23 | FromGitter | <skellock> ryukoposting: just watched it... well done! I didn't know about closure iterators. I wouldn't have minded seeing a quick bullet point list up front saying, "here's what you're about to learn". |
23:18:14 | * | rnrwashere joined #nim |
23:22:09 | FromGitter | <skellock> ryukoposting: related: 1. is there a way to early exit from an iterator (return doesn't seem to work for me)? 2. can iterators only be consumed by a `for` statement? thx! |
23:26:16 | * | krux02 quit (Remote host closed the connection) |
23:27:32 | FromDiscord_ | <juan_carlos> break is shown on the video. |
23:30:03 | * | abm quit (Ping timeout: 245 seconds) |
23:31:13 | FromGitter | <skellock> juan_carlos: it's used in the consumption part.. was curious to know if within an `iterator` function itself |
23:32:16 | FromDiscord_ | <juan_carlos> Theres an iterator on the consumption part too later on. But I get the idea. |
23:34:43 | FromGitter | <skellock> nim blows my mind man |
23:35:04 | FromDiscord_ | <juan_carlos> ;D |
23:37:49 | xace_ | ryukoposting: looked through your video. I like it and think it's ready for release... |
23:38:57 | FromDiscord_ | <juan_carlos> Yeah, cool video!. 👍 |
23:39:20 | ryukoposting | thanks guys :) |
23:39:34 | ryukoposting | I'll throw together a page on my site for it tonight |
23:39:36 | rayman22201 | Still watching, but I agree |
23:39:40 | * | rnrwashere quit (Remote host closed the connection) |
23:39:40 | rayman22201 | It's good dude! |
23:40:17 | * | rnrwashe_ joined #nim |
23:41:37 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
23:43:46 | rayman22201 | ryukoposting. What editor are you using in the video? What are you using to get the animation for the matching paren? |
23:44:05 | rayman22201 | it's very nice for presentations |
23:44:22 | ryukoposting | that's Kate |
23:44:37 | rayman22201 | geeze. I haven't used Kate in forever. cool. |
23:44:54 | ryukoposting | (side note, there's a Kate plugin for Rust that connects to their lang server, if Nim had that it'd be really neato) |
23:45:40 | ryukoposting | yeah I normally use a modified version of Sam, but the lack of syntax highlighting and font scaling makes Sam a pretty awful editor for screencasts |