<< 13-02-2019 >>

00:03:03shashlickis it possible to get the ast at a particular point in a file
00:03:19shashlickstmt1; stmt2; xyz; stmt3 - can you get the ast at xyz point
00:05:07FromDiscord_<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:48shashlicki think that's your answer @treeform
00:17:20FromDiscord_<treeform> Interesting, so you are using macro to generate templtaes
00:17:24FromDiscord_<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:44FromGitter<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:57FromGitter<deech> Updated `devel` and I'm getting different errors now, opened an issue: https://github.com/nim-lang/Nim/issues/10657.
02:07:44leorizedeech: it's normal
02:08:07leorizethose tests are to ensure that the code in Nim in Action book would still be valid for the current version
02:11:45FromGitter<deech> Ok, I'll close. But I suggest there should be under a flag, eg. `-d:niminaction`.
02:15:53leorizenah, then the devs would just skip them :P
02:16:41leorizethe test suite would keep running if those failed anyway, so it's not too much of a problem
02:17:23FromGitter<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:01FromGitter<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:54FromDiscord_<juan_carlos> add on what?
02:54:15FromGitter<dawkot> collections in general. sequences, strings
02:54:53FromDiscord_<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:59sealmoveguys how does env nimrc work?
04:34:36*banc joined #nim
04:42:24leorizesealmove: nimrc?
04:43:17sealmovethe other day someone told me you can use #!/usr/bin/env nimrc to mimic scripting while using normal Nim (instead of NimScript)
04:43:45sealmovebut I that doesn't work out of the box, so I wonder how to set it up
04:45:17leorizeI think they mean nimrun instead
04:45:26leorizeit's a nimble package
04:45:37leorizesee https://github.com/lee-b/nimrun
05:00:09sealmoveHmm, 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:07FromDiscord_<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:21rayman22201what do you mean by non-blocking?
05:26:13*dddddd quit (Remote host closed the connection)
05:27:01rayman22201or a better question, what are you trying to accomplish? maybe we can help you figure out the right feature for the job.
05:28:15FromDiscord_<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:35FromDiscord_<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:01rayman22201Always glad to have more people try the language :-)
05:30:38rayman22201what sdl bindings are you using?
05:31:22FromDiscord_<Geroro / Grey Ghost> its a nice language :) nim-lang/sdl2
05:31:22rayman22201ah. ok. {.async.} should help you here. But the library you are using might not be playing nice with async
05:32:18FromDiscord_<Geroro / Grey Ghost> and sdl2/image
05:32:47*disruptek quit (Quit: Bye)
05:38:06rayman22201does sdl2 let you do non-blocking calls in general?
05:38:56rayman22201I'm not super familiar with sdl2, but I don't see anything in the docs for sdl2 about non-blocking io
05:40:21FromDiscord_<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:45rayman22201async != threads
05:41:33rayman22201async 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:02rayman22201but the IO has to support non-blocking IO for that to work
05:42:59FromDiscord_<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:20rayman22201If you want to use threads, that's a totally different thing. You would use spawn or create_thread yourself.
05:43:28rayman22201No worries. I don't mind helping.
05:44:17rayman22201if gets you to stick with Nim anyway :-P
05:44:36FromDiscord_<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:59rayman22201lol. Yeah. Nim has a very unique way of dealing with threads and GC.
05:49:33rayman22201this is good reading for threads: https://nim-lang.github.io/Nim/manual.html#threads
05:52:52rayman22201And 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:53FromDiscord_<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:14FromGitter<mratsim> @Geroro / Grey Ghost, for non-blocking IO you should use async
07:11:53FromGitter<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:02Zevvno *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:21narimiran@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:09narimiran@brentp you here?
08:17:58FromGitter<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:14FromGitter<mratsim> maybe with a staging/open question - for example this: https://github.com/nim-lang/Nim/issues/10661
08:22:25FromGitter<mratsim> staging section*
08:27:27PMunchWriting Python makes me miss Nim :(
08:27:47PMunchIt feels about the same, but I miss my types
08:28:03PMunchAnd 4-wide tabs now feels so wasteful :P
08:29:31narimiranPMunch: google used 2-space indentation in python
08:29:45PMunchDoes that work?
08:29:53PMunchI thought it had to be 4 spaces or tabs
08:30:59narimiranhaha, you can have any amount of spaces, but it must be consistent
08:38:58FromGitter<mratsim> you can configure the default spacing for your editor
08:39:28FromGitter<mratsim> for types, you can "import typing" and for type checking you have to call "mypy" on your Python program
08:41:18narimiran+1 for `import typing` and `mypy` - this was my nim before i discovered nim :)
08:46:13*neceve joined #nim
08:51:17narimiranyou 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:56FromGitter<Bennyelg> does Nim support tail recursion ?
09:59:16*vlad1777d quit (Remote host closed the connection)
10:00:36Araqnope, the underlying C/C++ code support it but don't rely on it
10:00:44Araqnope, the underlying C/C++ compilers support it but don't rely on it
10:01:01FromGitter<Bennyelg> @Araq thanks.
10:02:14*vlad1777d joined #nim
10:06:37*rayman22201 quit (Quit: Connection closed for inactivity)
10:06:51FromGitter<mratsim> see: https://forum.nim-lang.org/t/3931
10:10:01FromGitter<mratsim> but if you are trying to do something functional style, you might have better luck with "it" templates (anamorphic templates)
10:11:49narimiranquick question, because i always forget (confuse the two of them): what to replace `stmt` with, and what `expr` with?
10:12:01leorizestmt = 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:59narimiranthanks leorize
10:41:10FromGitter<mratsim> no
10:41:14FromGitter<mratsim> it's the inverse
10:41:20narimiranhaha
10:41:27narimirannow you see why i'm confused
10:41:30FromGitter<mratsim> a statement is supposed to have a void type
10:41:57FromGitter<mratsim> also when you use a macro with newStmtList() it returns untyped usually
10:42:14FromGitter<mratsim> an expression is typed (int, string ...)
10:42:29*solitudesf quit (Read error: Connection reset by peer)
10:45:20FromGitter<mratsim> but basically untyped means you want an AST tree that hasn't pass semcheck
10:45:45FromGitter<mratsim> so you can use it for both expr and stmt
10:47:06*solitudesf joined #nim
10:50:04narimiranthanks @mratsim, i've written down what you've said, hopefully there will be no future confusions
10:50:34Araqwatch 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:25narimirandom96, dom96_w: is there a reason why nimforum is not available as nimble package? (can i add it?)
12:42:51dom96_wI guess
12:43:08dom96_wit won't work though
12:43:13dom96_wso actually no
12:43:29dom96_wNimforum needs files which it won't be able to find if it's installed by Nimble
12:45:59narimiranok, 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:40FromGitter<mratsim> btw, will we have seq/strings destructors in 0.20?
13:48:42*Vladar joined #nim
14:09:42FromGitter<brentp> @narimiran what's up?
14:10:23narimiran@brentp same question as for dom above: is there any reason why mosdepth is not available as nimble package?
14:11:14FromGitter<brentp> it was my first nim program.... and not very useful as a package.
14:12:17narimiranit has a lot of github stars :)
14:12:35*seni joined #nim
14:12:50narimiranbased on that, i wanted to include it in our tests to see if devel breaks popular nim packages
14:14:15FromGitter<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:42narimiranyeah, i already included `hts` :)
14:15:19FromGitter<brentp> great. where are you doing this?
14:16:54narimiranin my branch. still some problems with CI. it will be merged once it works ok
14:24:28*Perkol joined #nim
14:25:27PerkolI'm trying to use nim with vscode but get error:No 'nim' binary could be found in PATH: '/app/bin:/usr/bin'
14:26:06PerkolEven through nim installed and have executable in /usr/bin/nim
14:26:23narimiranPerkol: "have you tried turning it off and on again?"
14:26:48Perkolvscode? yes
14:30:19narimiran`nim -v` works in your terminal?
14:31:08PerkolHm, disabled enabled plugin, now works
14:31:48narimiranhehe, "have you tried turning it off and on again?" wins once again :D
14:33:05FromGitter<brentp> @narimiran if it will help, I'll make mosdepth a nimble package.
14:33:46narimiran@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:16FromGitter<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:00FromGitter<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:10FromGitter<Bennyelg> can we kill those ;)
16:13:50*rnrwashere joined #nim
16:23:52narimiranhttps://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:28FromGitter<Varriount> @Bennyelg If you're using Postures, you could write a hook that does query rewriting
16:39:45FromGitter<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:34smitopHow do I use the [] operator on a pointer
17:08:42smitopAs I can do with C/C++
17:09:00dom96_wcast it to an array
17:10:38Araqcast it to 'ptr UncheckedArray'
17:11:18FromGitter<mratsim> cast it away =)
17:12:02leorizeis there any use case for `UncheckedArray` without `ptr`?
17:12:44FromGitter<mratsim> I think it's not allowed anymore
17:13:11FromGitter<mratsim> but you can have an object wrapping len + UncheckedArray
17:13:17FromGitter<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:16narimiranbtw, 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:57narimiranbut 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:47FromGitter<Bennyelg> @Varriount unfortunately postgres is not olap its oltp
17:23:13FromGitter<Bennyelg> but can you elaborate about the query rewrite?
17:32:14FromDiscord_<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:05FromDiscord_<juan_carlos> Python is adding its own ./node_modules/ named ./__pypackages__/ 🤔🤔🤔
17:56:11FromDiscord_<juan_carlos> You can always add more stuffs intead of fixing the existent ones with yet another way to install packages.
17:57:28FromGitter<mratsim> fixing can break others while adding will not
17:58:07FromGitter<mratsim> I think that's closely related to the second law of thermodynamics, entropy (the measure of chaos) can only rise.
17:58:32FromDiscord_<juan_carlos> They recently breaking C API and Regex. Not counting 2 to 3 thingy.
17:59:22FromDiscord_<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:40FromDiscord_<juan_carlos> I cant remove the asmNoStackFrame tho, it wont compile without that.
18:00:27FromGitter<mratsim> why don't you create proper functions?
18:01:03FromDiscord_<juan_carlos> They are functions (?)
18:01:22FromGitter<mratsim> you cannot pass parameters to them
18:01:28FromDiscord_<juan_carlos> They are just examples :P hehehe
18:01:50FromDiscord_<juan_carlos> `arg` wont work, try one and youll see. :(
18:02:02FromDiscord_<juan_carlos> the `` thing
18:02:08FromGitter<mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c645ba0ef98455ea42d62e9]
18:02:55narimiran:mratsim mic-drops:
18:04:00FromGitter<genotrance> how do you pass data around in a generic way without casting
18:04:01FromDiscord_<juan_carlos> I know, also Ive seen std lib, but I dont know how it works, std lib puts values without the ``
18:06:00FromGitter<mratsim> `` is interpolation
18:06:18FromGitter<mratsim> I'm not sure how to do it with intel syntax unfortunately
18:06:34FromGitter<mratsim> basically you have to look into the registers used by your function
18:06:40*rnrwashere joined #nim
18:07:00FromGitter<mratsim> for example: https://www.felixcloutier.com/x86/mul
18:07:14FromGitter<mratsim> source: RAX and R/M, destination RAX
18:08:00FromGitter<mratsim> sorry RDX (high word) and RAX (low word)
18:08:18FromDiscord_<juan_carlos> I want something thats like a string formatting before passing it to asm statement, maybe Ill create a macro later.
18:08:23FromGitter<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:21FromGitter<mratsim> i.e. if you give me the signature you want for your op, I can update the examples
18:10:03FromGitter<mratsim> @genotrance [T]?
18:10:56FromDiscord_<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:21shashlick@mratsim - think more in terms of using the same channel to pass different data types thru it
18:11:36shashlickSo the channel is agnostic, the endpoints know that to do
18:12:38FromGitter<mratsim> and type is known at runtime or compile time?
18:13:34FromGitter<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:58FromGitter<mratsim> @juancarlospaco: no idea here, seems like a and b are passed via ecx and edx.
18:18:12FromGitter<mratsim> afaik those are the registers used in _fastcall calling convention
18:18:20*rnrwashere quit (Remote host closed the connection)
18:18:40shashlick@mratsim: i'd say known, but across dlls
18:19:45FromGitter<mratsim> you will need an instantiated proc for each concrete type with a different name then.
18:20:07*vendethiel- joined #nim
18:20:11shashlickor resort to pointers
18:20:30*rnrwashere joined #nim
18:20:49shashlickits the channel that's defined with a particular type
18:21:14shashlickam just wondering how queues, msg busses etc, handle this generic problem
18:21:23FromGitter<mratsim> @jivank, that may be more suited for the forum
18:21:50FromGitter<mratsim> @shashlick wire serialization
18:23:34shashlickya that will be too slow since this is in the same process, same thread
18:23:43shashlickwill have to look for something else
18:28:02*TheLemonMan joined #nim
18:28:25TheLemonManjivank, what about streams?
18:30:29TheLemonManjesus, appvoyeur keeps timing out
18:30:52TheLemonManmaybe the package test pipeline can be moved to Azure CI or something else
18:31:40FromDiscord_<juan_carlos> Wont Travis support all OS now?. I didnt try tho...
18:32:01narimiranwe have problems with travis too
18:32:22TheLemonManmaking Travis even slower than it already is is not a solution
18:32:30FromDiscord_<juan_carlos> hahaha Oh My Gauss :(
18:33:08narimiranazure pipelines should supposedly be much faster, but that PR never delivered....
18:33:50FromGitter<mratsim> we have the same issue in Status
18:33:54FromGitter<mratsim> 2 hours for Appveyor
18:33:55FromGitter<iffy> How could I print out N bytes of memory starting at `pointer`?
18:34:34TheLemonManwe just have to summon Timothee to fix that :D
18:35:09*FromGitter * mratsim Summon Elemental IX
18:36:22FromGitter<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:11TheLemonManiffy: for i in 0 .. N: echo cast[ptr UncheckedArray[byte]](myPointer)[i]
18:37:22FromGitter<mratsim> the quick hack is to cast to array[N, byte]
18:37:36FromGitter<mratsim> ptr array* and then dereference
18:37:37*vendethiel- joined #nim
18:37:46FromGitter<iffy> okay, let me try those
18:37:55FromGitter<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:14FromGitter<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:24FromGitter<iffy> @mratsim and @TheLemonMan thank you for your help. Here's what I ended up with: https://gist.github.com/iffy/a961cdd7625a54e6b179aa2f0d200b54
19:01:42TheLemonMannoice
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:22FromGitter<jivank> TheLemonMan: maybe just have the body be written directly to disk and return a stream (from disk) back
19:39:37FromGitter<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:30FromGitter<iffy> Specifically, the first string of `res.rows[5]` changes from `"5"` to `"\0\0\0\0"`
19:43:08TheLemonManjivank, that'd be extremely inefficient
19:45:55FromGitter<iffy> I'm using `--gc:markAndSweep` if that makes a difference
19:46:39FromGitter<jivank> TheLemonMan: in what way?
19:48:14FromGitter<jivank> it seems werkzeug is doing something like that https://github.com/pallets/werkzeug/blob/master/werkzeug/formparser.py#L45
19:49:52TheLemonManI'm no http server expert but that sounds incredibly wasteful to me, IO is not free
19:51:20FromGitter<jivank> i guess more reason to let the user handle the socket
19:52:10*vendethiel- quit (Ping timeout: 272 seconds)
19:56:21FromGitter<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:38TheLemonManhopefully
19:57:57FromGitter<iffy> *something* that's running during that loop is messing up memory. How can I make sure it's not Nim?
20:00:52TheLemonManwhat else is running?
20:01:01FromGitter<iffy> Node.js
20:01:24TheLemonManeh
20:10:00shashlickhow can i get to the stack trace of a crashed dll call (nim dll)
20:10:18shashlicki can catch the crash exception but don't get any exception message in the trace
20:15:36FromGitter<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:20TheLemonManwell if you're not doing anything unsafe (casts & addr for example) you can rule that out
20:30:35FromGitter<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:45caffasorry wrong channel
20:56:49*caffa quit (Client Quit)
20:57:42FromGitter<skellock> apology accepted
21:09:36*Tyresc joined #nim
21:11:03FromGitter<iffy> Why does this show 2 different addresses for `res.rows[5][0]`?
21:11:16FromGitter<iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c6487f45095f6660cebee71]
21:11:30FromGitter<iffy> output:
21:11:36FromGitter<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:19rayman22201I'm not sure, but shouldn't you cast a pointer to a uint64?
21:30:41rayman22201assuming you are on a 64bit machine
21:32:59FromGitter<iffy> same thing with uint64
21:33:10FromGitter<iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c648d15ef98455ea42ee1c8]
21:33:10rayman22201what type is rows?
21:33:19FromGitter<iffy> I made a simpler example ^
21:33:26FromGitter<iffy> ```0x106e83058"something" ⏎ 0000000106E3BB48``` [https://gitter.im/nim-lang/Nim?at=5c648d25126af75deb9fee97]
21:34:49rayman22201yeah, repr copies strings. try `repr(res.rows[5][0].unsafeAddr)`
21:35:14FromGitter<iffy> it copies strings!?
21:35:20FromGitter<iffy> I trusted you, repr!
21:35:37rayman22201lol. Here is the compiler source code for repr: https://github.com/nim-lang/Nim/blob/3f6168b3372013c0d4b938e6a83849199d9756c9/lib/system/repr.nim#L18
21:36:10rayman22201all the gory details :-P
21:36:34*Vladar quit (Remote host closed the connection)
21:37:24FromGitter<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:45FromGitter<iffy> so... wait, okay, yes it's a ref to where the string actually si
21:38:24rayman22201boom. there you go :D
21:38:38Araqrepr doesn't copy the string
21:38:48FromGitter<iffy> yes, thank heavens
21:39:18rayman22201I thought it did for some reason. cool. good to be wrong about some things
21:40:25*vlad1777d joined #nim
21:40:33FromGitter<iffy> So... how can I do that dereferencing myself to get a pointer = 0x101f0f058?
21:43:39FromGitter<iffy> looks like `castpointer (mystring)` does that
21:45:35FromGitter<iffy> errr... no, that points to a spot before the real place in memory
21:45:53rayman22201I'm not familiar with that function
21:46:47rayman22201addr(mystring) maybe?
21:47:21FromGitter<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:47FromGitter<iffy> addr(mystring) returns the same as unsafeAddr(mystring)
21:49:01rayman22201oh.... `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:45krux02@iffy: addr and unsafeAddr is supposed to return the same value
21:52:03FromGitter<iffy> right
21:53:12krux02I didn't follow the entire conversation, what do you want to do with this addr of a string?
21:54:01FromGitter<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:08FromGitter<iffy> `toHex(castuint64 (cast[pointer](s[0].addr)))`
21:54:24krux02ah
21:54:32krux02yea strings are a bit special
21:55:09krux02you better go via cstring
21:55:22rayman22201I'm looking at what repr does. convert it to a cstring maybe? `toHex(cast[uint64](cstring(s).unsafeaddr))`
21:55:52krux02cstring(s) is basically `cast[ptr char](s[0].addr)`
21:56:34krux02so toHex(cast[uint64](cstring(s))) is what you really want
21:56:44rayman22201👍
21:56:56krux02I don't have that emoji
21:57:15rayman22201lol, does it show up as a box? It's jut a thumbs up like github
21:57:42krux02it's some hex values in a box
21:58:34krux02the cstring variant is really what you should do, as s[0] might crash with a segfault on empty strings.
21:58:39FromGitter<iffy> perfect, that's much shorter (the cstring() method)
21:59:53krux02repr is an old feature of nim that was supposed to be the default debugging swiss army knife that works for everything.
22:01:03krux02But 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:12FromGitter<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:25krux02by now the `$` operator took over the `repr` function for almost everything
22:01:33krux02except NimNode printing
22:02:46krux02well I would assume this: ``cstring("5")[] == '5'``
22:04:16krux02@iffy, so if you mean that, then yes
22:04:34FromGitter<iffy> Okay yes, `var s = "5"; echo castbyte (cstring(s)[0])` prints out "53" but in my program
22:05:01krux02no that is wrang
22:05:10krux02don't cast a pointer type to a byte
22:05:31FromGitter<iffy> how come?
22:05:57krux02oh, sorry
22:06:06krux02didn't see the []
22:06:18FromGitter<iffy> yeah, this markdown thing gets in the way a bit
22:06:40krux02this time it was my bad
22:07:35FromGitter<iffy> krux02: this is the problem I'm trying to solve: https://gist.github.com/iffy/c31198e66fe51f8dcaf6c4289fab8f43
22:08:16krux02the 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:37krux02@iffy: I don't get the problem in that gist
22:12:10krux02@iffy you print several times the exact same date: ``res.rows[5].repr``
22:12:28FromGitter<iffy> And yet it's different after the first time
22:12:45FromGitter<iffy> (see output.txt line 5 vs line 2)
22:14:05krux02that should not happen
22:14:13krux02but I can't reproduce here
22:14:19krux02did you try to not use repr?
22:14:20FromGitter<iffy> That's what I need to hear.
22:14:48FromGitter<iffy> This is being run as a Node.JS addon; so I suspect Node is messing things up
22:15:15FromGitter<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:12krux02@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:28Araqlol, really?
22:24:46krux02?
22:24:52AraqI think looking at the generated code is counter-productive for most people
22:25:02krux02well not for me
22:25:36krux02it's a mess when line information is enabled. but on release mode it is quite readable
22:25:52krux02it is not too far away from the original Nim code.
22:26:29krux02but 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:18FromGitter<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:57FromGitter<iffy> I
22:38:22FromGitter<iffy> 've tried getting something reproducible, but the problem too often goes away when I shrink the code
22:38:47FromGitter<iffy> But I'll keep trying to get it reproducible
22:40:10FromGitter<iffy> rather -- shareable and smaller (it's definitely reproducible for me :) )
22:40:50shashlickThose gdb videos are helping me with my crashing dlls
22:41:05shashlickBut would be nice to just get a stack trace
22:42:18rayman22201@Varriount you could do `gcc -E`, but I have a feeling that would be worse not better lol
22:42:44Araqbeside NIM_CALL it doesn't use macros
22:44:36*ryukoposting joined #nim
22:46:06rayman22201@shashlick, does `--stackTrace:on` not work in a dll?
22:47:58ryukopostingsuper-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:42dom96oooh
22:52:28ryukopostingI'm planning to do the entire thing again, I think I can do better now that I've actually done it
22:52:46ryukopostingbut any advice would be fantastic
22:52:52dom96Nice editing so far and very clear narration
22:52:58ryukopostingty :)
22:53:46shashlickrayman22201: I'll try
22:54:02ryukopostingi3wm was made for this kind of video, all the switching between terminal and editor is just me switching desktops
22:54:35shashlickI have --debugger:native and also tried --lineInfo
22:56:40rayman22201I think those are both related to gdb. They don't really do anything for producing a stack trace directly
22:56:54FromGitter<bung87> why `compileProject ` very slow?
22:57:40dom96ryukoposting: Yeah, not criticism so far. Very clear and completely correct explanations :)
22:57:42dom96*no
22:58:12dom96I would release it as-is and start work on the next video :D
22:58:47ryukopostingI 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:51shashlickrayman22201 - no luck
23:06:07shashlickunless i need to -f for it to work
23:07:56rayman22201`-f` ?
23:08:24shashlickforce nim to recompile everything
23:08:34rayman22201oh I see
23:08:38rayman22201idk
23:17:23FromGitter<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:09FromGitter<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:32FromDiscord_<juan_carlos> break is shown on the video.
23:30:03*abm quit (Ping timeout: 245 seconds)
23:31:13FromGitter<skellock> juan_carlos: it's used in the consumption part.. was curious to know if within an `iterator` function itself
23:32:16FromDiscord_<juan_carlos> Theres an iterator on the consumption part too later on. But I get the idea.
23:34:43FromGitter<skellock> nim blows my mind man
23:35:04FromDiscord_<juan_carlos> ;D
23:37:49xace_ryukoposting: looked through your video. I like it and think it's ready for release...
23:38:57FromDiscord_<juan_carlos> Yeah, cool video!. 👍
23:39:20ryukopostingthanks guys :)
23:39:34ryukopostingI'll throw together a page on my site for it tonight
23:39:36rayman22201Still watching, but I agree
23:39:40*rnrwashere quit (Remote host closed the connection)
23:39:40rayman22201It's good dude!
23:40:17*rnrwashe_ joined #nim
23:41:37*ng0 quit (Quit: Alexa, when is the end of world?)
23:43:46rayman22201ryukoposting. What editor are you using in the video? What are you using to get the animation for the matching paren?
23:44:05rayman22201it's very nice for presentations
23:44:22ryukopostingthat's Kate
23:44:37rayman22201geeze. I haven't used Kate in forever. cool.
23:44:54ryukoposting(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:40ryukopostingyeah 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