<< 25-10-2018 >>

00:05:41*ghost64 joined #nim
00:12:03*ghost64 quit (Quit: See you!)
00:12:37*ghost64 joined #nim
00:25:20*PrimHelios_ joined #nim
00:31:53*ghost64 quit (Quit: See you!)
00:32:37*ghost64 joined #nim
00:41:59*darithorn_ quit ()
00:43:41*PrimHelios_ quit (Quit: Leaving)
00:43:52*PrimHelios_ joined #nim
00:43:53*PrimHelios_ quit (Client Quit)
00:44:15*PrimHelios_ joined #nim
00:46:56*zachk quit (Quit: Leaving)
00:54:51*PrimHelios_ quit (Quit: Leaving)
01:16:52*a_b_m joined #nim
01:18:47*abm quit (Ping timeout: 240 seconds)
01:37:27*a_b_m quit (Ping timeout: 240 seconds)
02:05:02*banc quit (Quit: ZNC - http://znc.in)
02:22:00*banc joined #nim
02:55:47FromDiscord<treeform> dom96, system's reopen works great Demos figured it out.
03:04:23*darithorn joined #nim
03:14:13*darithorn quit ()
03:29:15*chemist69 quit (Ping timeout: 252 seconds)
03:31:19*chemist69 joined #nim
03:42:32*ftsf joined #nim
04:12:08*Vladar joined #nim
04:14:56*darithorn joined #nim
04:18:26*stefanos82 joined #nim
04:50:40*endragor joined #nim
05:11:12*nsf joined #nim
05:18:12*ftsf_ joined #nim
05:21:03*ftsf quit (Ping timeout: 264 seconds)
05:22:54*narimiran joined #nim
05:29:23*darithorn quit ()
05:31:29*smt` quit (Read error: Connection reset by peer)
06:06:39*leorize quit (Quit: WeeChat 2.2)
06:13:30*narimiran quit (Ping timeout: 252 seconds)
06:16:47*Vladar quit (Ping timeout: 240 seconds)
06:19:11*krux02 joined #nim
06:27:29krux02good moring (or what is suitable for your time zone)
06:28:37*Pisuke joined #nim
06:29:10*MyMind quit (Ping timeout: 246 seconds)
06:30:14FromGitter<timotheecour> good evening :) @krux02 what do you think of https://github.com/nim-lang/Nim/pull/8166 : is 3d param a good idea?
06:30:55*Vladar joined #nim
06:34:11krux023d param?
06:34:23krux02I did a review already and I don't like it at all
06:34:30krux02it is way too low level
06:35:41FromGitter<timotheecour> well I read all ur comments and I agree; but besides of implementation (which I agree needs to improve), there’s a question regarding API: shd we allow a 3 param variant as he does
06:36:44FromGitter<timotheecour> the PR itself is desirable (we need `relativePath`) even if currently problematic.
06:39:44*couven92 quit (Read error: Connection reset by peer)
06:40:09krux02well Araq has a new path management module with distinct strings for relative and absolute paths
06:40:10*couven92 joined #nim
06:40:50krux02this module is much more type safe and it has a better implementation than that PR
06:43:14krux02I mentioned it, I like your PR about toSeq
06:43:38*Vladar quit (Ping timeout: 272 seconds)
06:43:45krux02I was disappointed it toSeq several times so that I barely used it, you hacked it to just work more often
06:44:12FromGitter<narimiran> +1 on making toSeq more usable
06:44:24krux02I don't like the fact that it feels very much like a hack, I would prfer if it could work somehow with overload resolution
06:45:22krux02narimiran: https://github.com/nim-lang/Nim/pull/8711 https://github.com/nim-lang/Nim/pull/8711
06:45:59FromGitter<timotheecour> well i do it via overload resolution (3 cases: iterator; not iterator; untyped)
06:47:21FromGitter<timotheecour> but right now it’s blocked by this comment https://github.com/nim-lang/Nim/pull/8711#issuecomment-432802139 which I don’t fully understand (if you have any tips on how to address it I’m all ears)
06:50:54*Vladar joined #nim
06:56:44*Araq_ is now known as Araq
07:00:35*mech422_ joined #nim
07:03:48*mech422__ quit (Ping timeout: 245 seconds)
07:06:07*Vladar quit (Ping timeout: 240 seconds)
07:13:21*Vladar joined #nim
07:13:48*Vladar quit (Remote host closed the connection)
07:14:04*rokups joined #nim
07:14:07*sagax_ joined #nim
07:22:14*Vladar joined #nim
07:24:44*jjido joined #nim
07:31:07*jjido quit (Ping timeout: 240 seconds)
07:49:03*jjido joined #nim
07:57:07*PMunch joined #nim
08:01:26FromGitter<alehander42> @dom96 , Araq @mratsim I think you misunderstand copygirl, iirc her goal was to have such an Either[T1, T2..] type that e.g. Either[T1, T2] is equivalent to Either[T2, T1] etc
08:02:24*jjido quit (Ping timeout: 252 seconds)
08:02:25FromGitter<alehander42> it's not so obvious how to do it just with variants as you need some kind of type ordering (and jsonNodes are very dynamic)
08:02:38FromGitter<alehander42> at least that's what i recall, maybe her requirements changed
08:04:31FromGitter<alehander42> on the other hand autogenerating variant fields based on the typename might also work
08:04:50FromGitter<alehander42> (also the converters idea that somebody (leorize ? ) had)
08:05:34FromGitter<alehander42> (i was also confused in the beginning)
08:08:33*floppydh joined #nim
08:15:57*jjido joined #nim
08:17:04*a_b_m joined #nim
08:34:15copygirlo.o?
08:34:34copygirlI have a macro that takes a `static[int]` but it appears the value is always 0.
08:46:27PMunchThat's strange, code snippet?
08:47:09krux02copygirl, static[int] in a macro is a compile time constant that is just an int value in macro context
08:49:08copygirlInteresting..
08:49:40PMunchYou can convert it to a static Nim node with newLit
08:50:11copygirlThat's what I'm doing.
08:50:27PMunchCode snippet?
08:50:30copygirlFor some reason in my macro, the value is 0. In another test macro it isn't.
08:51:34copygirlhttps://gist.github.com/copygirl/c1d5b87c88ce76baddc9ad8f148612c5
08:51:45copygirlThis prints out 1; 2; 0 when compiling.
08:52:45krux02copygirl, I can follow you up until 2, then I don't know what you are doing
08:53:43copygirlAt the bottom of the file I call makeEitherType(2) and the echo $size will print "0" for some reason.
08:54:05krux02don't use "parseStmt", use result = quote do:
08:54:15krux02and then the code you want to generate without the quotes
08:54:26copygirlquote does things I don't want.
08:55:40copygirlI tried it. It creates symbols and renames the parameters in ways that even break things. For example renaming "want" to "want758321", but not renaming it as the return type.
08:56:13PMunchI just get an error when I try to run that..
08:56:20copygirlSo I have a proc like `proc foo*(want756321: typedesc): want =`
08:56:36krux02instead of $node.indent use node.strVal
08:56:37copygirlI get an error too but also prints out something before that.
08:56:38*Vladar quit (Ping timeout: 272 seconds)
08:56:59PMunchAh right
08:57:17*hwallann quit (Remote host closed the connection)
08:57:47copygirlYou can comment out the echo result.repr and treeRepr to only get the 1; 2; 0 lines as output.
08:57:59krux02this seems weird
08:58:57krux02if you can isolate the the cause that triggers the echo $i to print the wrong value, please create an issue for it. This looks like a bug
08:59:10*copygirl nods.
09:00:26PMunchYeah this looks super strange
09:01:49copygirlI guess it's from the use of size in the inner proc.
09:02:55PMunchHmm, I tried to add let size = inSize and renamed the parameter to inSize
09:02:59PMunchThat made it work
09:03:28PMunchSo somehow the code after the echo changes the value of size :S
09:03:39copygirlhttps://gist.github.com/copygirl/24e560f007410ed6fef585666da570ea
09:04:13FromGitter<mratsim> the joy of working with types within macros
09:05:07copygirlShould I report it to the issue tracker?
09:05:31PMunchYes
09:05:36PMunchThat is definitely a bug :P
09:08:14*Vladar joined #nim
09:10:44*platoff joined #nim
09:11:02krux02yes
09:11:10krux02with that code example
09:11:12krux02that is good
09:11:14krux02I like it
09:11:34copygirlhttps://github.com/nim-lang/Nim/issues/9509 Is this a good issue?
09:11:39*dom96_w joined #nim
09:11:45*enthus1ast joined #nim
09:12:39krux02here is a workaround: http://ix.io/1pYV
09:12:58copygirl(You can do that??)
09:13:02krux02yes
09:13:11copygirlHow!? Why?!
09:13:27krux02it just shadows the parameter
09:13:58krux02the i on the right doesn't see it's onwn declaration yet, and the parameters are not the same scope
09:20:06*Arrrr joined #nim
09:27:17*enthus1ast_ joined #nim
09:29:36Araqhttp://cppconf.ru/talks/day-1/track-a/5.pdf
09:29:51*enthus1ast quit (Ping timeout: 260 seconds)
09:30:51*enthus1ast__ joined #nim
09:33:21*enthus1ast_ quit (Ping timeout: 252 seconds)
09:34:22*enthus1ast_ joined #nim
09:36:47*enthus1ast__ quit (Ping timeout: 250 seconds)
09:37:30FromGitter<narimiran> how to re-run CI tests? close PR and open it again later?
09:37:37Araqyup
09:37:47Araqyou can reopen it immediately though
09:43:40FromGitter<mratsim> there is a button now to “rebuild” directly on Travis
09:45:26FromGitter<mratsim> that certainly looks like a fun talk @Araq
09:45:55krux02Araq: the thing about string_view is pretty much summarized at the end, it is a borrow type, no ownership, short lived, can do without assignment op, only in function parameter lists, cannot be stored in data structures
09:46:50krux02this tells me that there is a change to implicitly work with string views in arguments
09:47:25krux02there is a function with argument string
09:47:57krux02looks like a value argument, but internally it is a string view
09:49:00krux02but yea it breaks at the ``dst : var string`` argument pattern
09:49:39FromGitter<mratsim> it’s like an openarray
09:50:22krux02yes
09:50:26FromGitter<mratsim> now to end the talk on a high note, let’s talk about utf8_string_view :P
09:50:48krux02nope
09:51:08krux02string is utf8
09:51:22krux02everything is utf8
09:51:43krux02and whoever disagrees is wrong or has a bug
10:01:45*jjido quit (Ping timeout: 252 seconds)
10:25:06*Stiggis joined #nim
10:27:48*crem quit (Ping timeout: 252 seconds)
10:29:39*crem joined #nim
10:31:15*vlad1777d_ joined #nim
10:35:47FromGitter<timotheecour> @araq where is `llStreamClose` called for this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd19c83069fca52a58fde8a]
10:37:17Araqin getIndentWidth, closeLexer
10:38:26FromGitter<timotheecour> Gotcha, indeed, thx; in the (near?) future, will that be replaceable by RAII?
10:38:35*enthus1ast_ left #nim (#nim)
10:38:42FromGitter<timotheecour> (less error prone etc)
10:38:52*enthus1ast joined #nim
10:39:16Araqyeah, getIndentWidth's inputStream becomes a 'sink' parameter
10:39:31Araqto signal ownership transfer
10:39:53Araqand llStream's close is a destructor, so everything works out
10:40:32FromGitter<timotheecour> cool..
10:47:24*enthus1ast_ joined #nim
10:50:09*enthus1ast quit (Ping timeout: 252 seconds)
10:50:21*crem quit (Ping timeout: 252 seconds)
10:52:18*crem joined #nim
10:52:30*platoff quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:53:04*enthus1ast_ quit (Remote host closed the connection)
10:55:49*enthus1ast joined #nim
10:57:15*kapil____ joined #nim
10:57:49*Arrrr quit (Quit: Arrrr)
10:59:30FromGitter<timotheecour> why `strip` in `if strip(readFile(expected)) != strip(readFile(produced)):` in nimpretty tester? isnt’ that loose ?
11:00:22*platoff joined #nim
11:01:04enthus1astlol just got banned from ##apple because i asked if there is a (official) way to run macos in virtualbox, to test code on it
11:02:05enthus1astis the bsd kernel still close enough to macos to test network code?
11:02:52*dom96_w quit (Changing host)
11:02:52*dom96_w joined #nim
11:03:03dom96_wyep
11:03:21enthus1astany recommendations? freebsdß
11:03:22enthus1ast?
11:05:29AraqPS4 runs on FreeBSD
11:05:32Araqso yeah
11:06:34enthus1astok thank you i'll try freebsd then
11:15:37krux02enthus1ast, I got banned from #archlinux, because I asked a question but my distro is manjaro
11:17:17enthus1asti must say, when the community is that hostile, and access to an os is not granted to developers, then it seems not worth to support it
11:17:59enthus1asthell i get even free windows vms :)
11:18:32PMunchHow did you get banned for that krux02, I've done exactly that multiple times .P
11:22:55krux02I don't know
11:24:45krux02enthus1ast, well consoles usually require you to get a development kit
11:25:13krux02you are not allowed to run your own executable on your own console
11:25:54krux02so even if you have the hardware, that is not enough to develop for it
11:27:44enthus1astits not about gaming consoles, i want to port my multicast lib to macos, by the way would this not be a good fit for net.nim?
11:28:05*Calinou_ is now known as Calinou
11:34:13FromGitter<arnetheduck> @Araq ping on https://github.com/nim-lang/Nim/pull/9029
11:37:27Araqok, resolve the conflict please and I prefer 'proc {.noSideEffect.}' over 'func' because all the existing code uses that, but it's a minor style thing and you can also keep the 'func'
11:40:07livcdenthus1ast: there are some osx cloud providers. You can use those
11:44:07*Snircle joined #nim
11:46:05FromGitter<Quelklef> Is there a way to force the type system to accept certain conditions?
11:46:09FromGitter<Quelklef> Like a cast, but more general
11:46:25FromGitter<Quelklef> I want to be able to assert that certain calls are `{.noSideEffect.}` even though they're not
11:46:29FromGitter<Quelklef> Like `debugEcho`
11:58:25FromGitter<timotheecour> @kaushalmodi I don’t understand your comment in https://github.com/nim-lang/Nim/pull/9510#discussion_r228139225
11:58:33FromGitter<timotheecour> where is it already defined?
11:59:51FromGitter<narimiran> @kaushalmodi thanks for pinging me on that macro issue
12:00:51*elrood joined #nim
12:18:31FromGitter<narimiran> can i somehow declare one field of my object to be `foo: array[<something_here>, float]`, and the length of it will be determined later (but still at compile time)?
12:18:57*smt joined #nim
12:19:04AraqQuelklef: cast the proc types, it's wordy but it works
12:19:23Araqcast[proc (paramsHerre) {.nimcall, noSideEffect.}](f)()
12:19:30FromGitter<Quelklef> Ah, duh. Thanks
12:19:49FromGitter<Quelklef> Yeah, I'd hope doing something this shady would be wordy and annoying lol
12:41:17FromGitter<narimiran> is there a way to specify (in nim.cft) in which directory i would like to have my binaries?
12:41:24FromGitter<narimiran> *nim.cft
12:41:31FromGitter<narimiran> god dammit, .cfg
12:43:37FromGitter<narimiran> i've tried with "o:../bin/<something>" (where <something> was $1, *, etc.), but it was always taken literally. it is output *file*, i want to define output *directory*
12:44:23FromGitter<timotheecour> @narimiran no but I’ve thought about something along what u described; and it’d be useful in combination with https://forum.nim-lang.org/t/4330
12:45:52FromGitter<narimiran> so i would need to create a separate "myfile.nim.cfg" for each file where i should specify where bin should go? :(
12:46:33FromGitter<narimiran> i've never used nims, can maybe that be more helpful? (i've seen on the forum that might be preferred over .cfg)
12:47:36FromGitter<timotheecour> well nims is more flexible, allowing executing scripts (instead of just declarative stuff like flags)
12:49:01FromGitter<timotheecour> in nims (or nimble files, which use also use nimscritp), u can call `exec` for eg which can in turn do stuff like: `exec “nim c -r -o:bin/baz test.nim"`
12:49:48FromGitter<timotheecour> not sure if `-o:foo` in cfg is considered good practice (never saw it before); but with nims u can do as i suggested
12:50:25dom96_wYou can use Nimble's `binDir` directive and compile using `nimble build`
12:50:27AraqI don't like either but I'm making nims robust for v1
12:50:52Araqsince as usual my own "much better stuff" is just stuff with unknown problems :P
12:51:08FromGitter<narimiran> what i like to have is `nim c -o:../bin/$1 $1.nim" so it works for any `.nim` file
12:51:55FromGitter<narimiran> @dom96_w i might try that
12:51:58Araqin theory -o:../bin/$projectName works
12:52:08Araqin practice it doesn't because of phase ordering problems
12:56:14FromGitter<timotheecour> how about: ⏎ `nim c —outputdir:bin bar.nim` => outputs to bin/bar ; 0 ambiguity, and really would help because now we can add `—outputdir` in nim.cfg (or `switch(“outputdir”, “bin”)` in top-level project config.nims , and then boom, it makes it really easy to conform to a build dir (see https://forum.nim-lang.org/t/4330 )
12:57:43FromGitter<timotheecour> avoids need to gitignore specific files, and allows putting generated files all in 1 place without custom complex setup in each nimble project
12:58:23FromGitter<timotheecour> FWIW in D they have introduced this flag `-od` with roughly same meaning.
13:00:15Araqyeah, let's have --outputdir
13:01:19FromGitter<narimiran> i've just tried nimble's `binDir` + `nimble build`, and: please, let's have `--outputdir`;)
13:02:14FromGitter<kaushalmodi> +1 for --outputdir!
13:06:01FromGitter<timotheecour> you can add your +1 here: https://github.com/nim-lang/Nim/issues/9513
13:06:55Araqimplement it already
13:07:19Araqit's part of our "Nim tooling" week where we improve Nim's tooling.
13:07:31*Vladar quit (Remote host closed the connection)
13:07:32Araq(nah, I just invented that...)
13:09:29FromGitter<narimiran> +1 on Nim tooling week :)
13:09:54FromGitter<timotheecour> @araq how should this behave: ⏎ `—outputdir:build -o:bar main.nim ` ? my vote is for bar ⏎ `-o:bar —outputdir:build main.nim ` ? my vote is for build/main ⏎ ie, latest option overrides previous [https://gitter.im/nim-lang/Nim?at=5bd1c0a1600c5f6423068be4]
13:10:45Araqdunno, keep in mind that --outputdir will end up in configs and -o not necessarily
13:10:50*xace quit (Ping timeout: 246 seconds)
13:11:12FromGitter<narimiran> @timotheecour why the result of both of those isn't `build/bar`?
13:12:56*xace joined #nim
13:13:53FromGitter<timotheecour> build/bar doesn’t make much sense; `-o:bar` always meant to write to bar; but the most flexible approach would be to allow: `-o:$outputdir/bar` (and of course, quote it in the shell)
13:14:57FromGitter<timotheecour> therefore user can choose whether to override (`-o:foo/bar`) or take advantage of (`-o:$outputdir/foo/bar`)
13:15:42FromGitter<kaushalmodi> @timotheecour having them order dependent is too confusing
13:16:07FromGitter<kaushalmodi> Let both orders do the same thing, and have it documented
13:16:47FromGitter<kaushalmodi> It's better to simply prefix outputdir to whatever output is
13:16:47FromGitter<narimiran> well, it is not that somebody has been using `outputdir` from before (because it didn't exist), so from now on, when you use both of them you should know what each of them does, so you don't define `-o:path/to/bar` together with `--outputdir:path/to`
13:17:18*kapil____ quit (Quit: Connection closed for inactivity)
13:17:52FromGitter<Vindaar> @narimiran (reg. your array question above) unless I misunderstand, you can use `static` like so ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd1c280435c2a518e024845]
13:18:22FromGitter<kaushalmodi> How about, if someone does --outputdir foo --output bar/zoo, we get foo/bar/zoo
13:18:37FromGitter<kaushalmodi> In essence --outputdir defaults to pwd
13:19:08FromGitter<narimiran> @Vindaar thanks! i knew it had to do something with `static` but i didn't know exactly how to do it :) but i think `seq` will do it :D KISS
13:19:20FromGitter<kaushalmodi> If --output is an absolute path (begins with /), ignore --outputdir
13:19:29FromGitter<narimiran> @kaushalmodi +1
13:19:31*chemist69 quit (Ping timeout: 250 seconds)
13:19:32FromGitter<kaushalmodi> @timotheecour ^^
13:20:32*chemist69 joined #nim
13:20:37FromGitter<timotheecour> i’d be ok with that
13:21:27FromGitter<narimiran> but why, oh why, would somebody define path two times? either you want your (one) file to be somewhere (use `o` when compiling that file), or you want the whole project to have some "bin directory" (use `--outputdir` in nim.cfg)
13:22:49FromGitter<timotheecour> why o why because configs are nested :)
13:23:18FromGitter<narimiran> ah, true :D
13:23:46FromGitter<timotheecour> so you may have a config in ~/.config/nim/config.nims that gets overridden by a myproj/config.nims that itself is overridden by myproj/subproj/config.nims
13:24:27FromGitter<kaushalmodi> This needs an RFC that has a table of all possible scenarios of these 2 switches
13:25:04FromGitter<kaushalmodi> And having them order independent is very important
13:25:05FromGitter<timotheecour> well the RFC is here: https://github.com/nim-lang/Nim/issues/9513
13:25:17FromGitter<narimiran> that means we can end up with `path/to/something/../../i/changed/my/mind` (where `path/to/something` is `--outputdir` defined somewhere, and then the rest is `-o`
13:25:37FromGitter<kaushalmodi> +1
13:25:42FromGitter<timotheecour> feel free to comment there ; I’ll keep updating top-level msgs until we all agree
13:25:52FromGitter<kaushalmodi> Heh, you already incorporated
13:26:02FromGitter<kaushalmodi> my suggestion :)
13:26:08FromGitter<timotheecour> haha ya
13:26:13Araqok, I take it back, RFC for this is appropriate
13:26:34Araqnothing is ever trivial...
13:26:49FromGitter<kaushalmodi> @timotheecour also add absolute path cases for --outputdir
13:27:22FromGitter<narimiran> can we have some example what the other languages do? (no, not just D, @timotheecour :D)
13:27:30FromGitter<kaushalmodi> For relative path cases that you have right now, make it evident that those are relative to PWD
13:27:45Araqalso keep in mind that --nimcache is unrelated and should stay unrelated
13:28:47*rockcavera quit (Ping timeout: 240 seconds)
13:29:15Araqso ... is nimpretty useful now?
13:30:39FromGitter<kaushalmodi> Araq: I haven't tried, not at pc. Does nimpretty have check-only mode, that returns error code if code is not already pretty?
13:30:51FromGitter<kaushalmodi> That will be very useful on Travis
13:31:48FromGitter<kaushalmodi> E.g. PR will fail if code is not "Nim pretty"
13:32:01FromGitter<kaushalmodi> Like what gofmt does
13:34:18FromGitter<narimiran> Araq: i started using it couple of days ago, but my code is already pretty so it didn't have much to do :D joking aside, beside some extra newlines added (i think that is now fixed), i find it quite good and useful. will test it some more
13:34:53FromGitter<timotheecour> @narimiran and @kaushalmodi I added algorithm section; lemme know whether u agree or if needs more description
13:35:17FromGitter<skellock> @kaushalmodi re: newt fork -- i was just messing around with it. No intention to wrap it. I did see someone did a long time ago in nim already, but I didn't try it. (sorry for the 2 week delay in replying -- i'm on "vacation".)
13:36:29Araqkaushalmodi: nah, you can run "nim pretty" and see if "git diff" is empty :P
13:37:42FromGitter<timotheecour> @araq well every time you fix a bug I retry on a bunch of files ; keeps getting better but still some blocks for widespread adoption
13:38:13FromGitter<timotheecour> it’s almost there though; haven’t seen any other bug than ones currently opened
13:39:26FromGitter<narimiran> Araq: now i found something that it might also fix: `0 .. <5` to change to `0 ..< 5`, this is not only style but "< is deprecated"
13:39:47Araqthe good news is that I now understand nimpretty :P
13:40:11FromGitter<timotheecour> @araq can nimpretty be a building block for nimfix2 ?
13:40:49FromGitter<timotheecour> (for nimfix2 i want to be able to allow a user to write custom transforms, eg switch 2 args)
13:41:27FromGitter<alehander42> is nimfix2 an automated refactoring tool?
13:41:45Araqseems too low level, if you want nimpretty to produce a seq/list of tokens with line information
13:41:49FromGitter<timotheecour> that’d be the idea, allowing advanced refactoring based on arbitrary user defined macros
13:42:35Araqthe old "nimfix" seems better for that, only touch what you must
13:42:52FromGitter<alehander42> @timotheecour I remember there was an ast-based search/replace tool for JS I really digged http://www.graspjs.com/ I was planning to port it to ruby ages ago
13:43:00FromGitter<timotheecour> the hope would be to have minimal impact on source code except for changes specified in user defined macro; so i was hoping nimpretty could help there (modulo maybe adaptation)
13:43:35FromGitter<alehander42> sounds very similar to this idea
13:43:41FromGitter<timotheecour> Oh, so the flow would be: code=>nimfix2=>nimpretty
13:43:58Araqor just "nimfix2"
13:44:00krux02Araq: what is the module/fieled that is used ot generate global variables into
13:44:03Araqor just "nimpretty"
13:44:19Araqkrux02, sfGlobal in sym.flags
13:45:00krux02that I know, but that is just how I detect a global var
13:45:09krux02I would like to know where it is generated into
13:45:19krux02the localtion of the string/rope
13:45:32krux02in BProc
13:45:39FromGitter<timotheecour> @alehander42 ya there are similar tools based on libclang that are somewhat hard to use but powerful ; oh and google used a bunch of these for massive scale code refactorings
13:45:42Araqadd(p.module.s[cfsVars], decl)
13:45:50FromGitter<timotheecour> (beyond just renaming)
13:45:52FromGitter<alehander42> @timotheecour the benefit of a grasp-like tool is that it also lets you search in codebases way more powerfully based on ast wildcards
13:45:57FromGitter<alehander42> compared to regex
13:46:35FromGitter<alehander42> probably, yeah, I think I also watched a fb talk on fosdem for one similar tool
13:46:38FromGitter<alehander42> maybe infer
13:46:49FromGitter<timotheecour> yes no doubt AST is more powerful than regex for that task, never doubted that :)
13:47:22Araqfor large scale refactorings you need large code bases
13:48:15FromGitter<timotheecour> large scale for us would be: “go fix all nimble packages to upgrade to new breaking change in compiler and automatically send PRs"
13:48:16FromGitter<alehander42> infer is different, maybe i don't remember correctly
13:49:10AraqI prefer to minimize the "breaking changes" though
13:49:27Araqotherwise you have even more reasons to keep the current style of development
13:49:37Araqwhich is terrible.
13:50:15Araq"hey, you are not big yet and I'm new so everything that came before me is kinda irrelevant, so let's just use markdown everywhere"
13:50:38Araqno offense implied.
13:52:23FromGitter<timotheecour> no offense taken. markdown is a different topic (which originated here https://forum.nim-lang.org/t/4280#26755 ; i didnt’ start it but embraced it)
13:52:48Araqit was only an example, it applies to everything
13:52:59Araq"so make Nim case sensitive"
13:53:05Araq"so make Nim use braces"
13:53:07FromGitter<alehander42> well, that's not very objective: some things just can be done in a better way
13:54:11FromGitter<timotheecour> in a closed ecosystem (eg tech company with monorepo) breaking changes happen all the time and are “easy-ish" to handle via automation; in a open eco-system with standardized package manager (nimble), this could be possible too via such nimfix based tooling
13:54:12FromGitter<kaushalmodi> Braces or not is very subjective, and your preference is respected there. But Markdown wins over RST hands down in the tech field
13:54:50FromGitter<kaushalmodi> I think the Markdown argument is not in the same category
13:55:02FromGitter<alehander42> that's not even the problem
13:55:08FromGitter<alehander42> the problem is that this is not even pure rst
13:55:16FromGitter<alehander42> it's rst + some other features
13:55:24FromGitter<alehander42> but this isn't too important, I agree
13:55:32FromGitter<kaushalmodi> That too, and pure rst is very limiting
13:55:42AraqI would just add the 3 features from markdown that you miss and call it a day
13:55:57Araqcurrently it's an RST dialect
13:56:08Araqand every markdown impl we choose would be a dialect
13:56:21Araqso you might as well take the easy route and patch the existing dialect
13:56:52FromGitter<alehander42> well, as long you don't have ambiguity , this might work as well
13:56:56Araqand Nim's variant of RST is documented fwiw
13:57:11Araqmaybe incompletely, but that's really easy to improve
13:57:38*PMunch quit (Quit: Leaving)
13:57:50*dddddd joined #nim
13:58:20FromGitter<alehander42> well, fossil is also well documented
13:58:24FromGitter<timotheecour> Again, automation can help here; see automatically converted RST => markdown docs: https://github.com/timotheecour/Nim/blob/pr_rst_to_markdown_contributing2_output2/doc/contributing.md
13:58:37FromGitter<alehander42> but if a project comes tomorrow with fossil, people would still be like "wait, i have to learn a different vcs"
13:58:45*vlad1777d_ quit (Ping timeout: 244 seconds)
13:58:51Araqagain, automation doesn't help much
13:59:07Araqfor a start I need to adapt to markdown syntax.
13:59:22Araqand so would every other Nim user who happens to like RST
14:00:38Araqsecondly, "stay tuned, we created PRs for all Nimble packages out there" is a questionable idea. the PRs may not be applied
14:01:02Araqfor all sort of reasons
14:01:06Araqlack of time to review it
14:01:26Araqabandoned packages (aha! so I fork these -- yeah ok...)
14:01:42Araqlack of consensus (I liked the old style better, thanks)
14:02:43Araqyou're trying to fix social problems with technology, I don't believe in that.
14:07:03FromGitter<timotheecour> nim-lang can host a mirror of a whitelist of nimble packages and push commits there; the PR’s would still need to be accepted by upstream obviously, but it’d at least allow to apply a change on a nimble-packages scale automatically. I think that’s worth exploring down the line to improve apis (again, in closed ecosystem, ability to automate changes on large scale really improves codebases)
14:11:07FromGitter<kaushalmodi> I think that PR-botting is going overboard :)
14:11:35FromGitter<timotheecour> anyway that’s not for anytime soon.
14:11:55FromGitter<kaushalmodi> Yeah, this was going into yak shaving
14:12:08FromGitter<kaushalmodi> Let's focus on objective merits of Markdown
14:18:15dom96_wOne of the most important reasons against switching from rST to Markdown is: we need 1.0!!!!
14:19:19Araqdom96_w, +1000
14:19:20dom96_wThere are far more important things that we should consider changing, things that are actually a detriment to adoption
14:19:32dom96_wAlthough even those are debatable
14:19:53dom96_wI haven't heard anyone complain about Nim's use of rST
14:20:02dom96_wNot a single person
14:20:25dom96_wUntil recently at least :P
14:20:35FromGitter<kaushalmodi> People who actually work on documentation know the documentation warts
14:20:35FromGitter<alehander42> which takes us to .. where is the nim survey blog :D
14:20:46FromGitter<kaushalmodi> i.e. issues with rST
14:20:59dom96_walehander42: 90% finished
14:21:28FromGitter<kaushalmodi> dom96_w: I made my first doc PR and I ended up with this rST limitation: https://github.com/nim-lang/Nim/issues/9070
14:21:43FromGitter<kaushalmodi> so unless people actually document, they won't know the issues with rST
14:21:52FromGitter<alehander42> *blows the dust from the needed-libraries issue generator*
14:21:54*ftsf_ quit (Ping timeout: 252 seconds)
14:22:00dom96_wIs this an rST limitation or a limitation with our parser?
14:22:01FromGitter<timotheecour> well almost everyone who posted in https://forum.nim-lang.org/t/4280#26755 seemed to agree markdown is a better choice; are there more important issues than RST/md? sure, no doubt.
14:22:12FromGitter<kaushalmodi> that's a limitation in rST spec
14:22:48FromGitter<kaushalmodi> so I at least don't agree that "people not complaining about rST" *like rST over Markdown*
14:22:53FromGitter<alehander42> what are to most important issues? the 1.0 milestone list?
14:24:14*endragor quit (Remote host closed the connection)
14:24:18dom96_wlol, I love how this has been a todo for rST since 2001 http://docutils.sourceforge.net/docs/dev/rst/alternatives.html#nested-inline-markup
14:25:06FromGitter<kaushalmodi> dom96_w: Your comment about 1.0 release can be easily flipped around
14:25:17FromGitter<kaushalmodi> Nim 1.0 supporting Markdown docs can boost its adoption
14:25:50dom96_wI think it has a strong chance doing the exact opposite
14:25:54FromGitter<kaushalmodi> every Tom, Dick & Harry commenting on Reddit, GitHub, Gitlab, Stackoverflow, etc. would know how to write Nim docs
14:25:55*narimiran joined #nim
14:25:58dom96_wPeople have a limit of how many breaking changes they can take
14:26:01*endragor joined #nim
14:26:10dom96_wAnd honestly, rST isn't that hard
14:26:29dom96_wwe can fix those parser limitations
14:26:34FromGitter<kaushalmodi> rST is more like trying to do things that you think are obvious, but don't work
14:26:48FromGitter<kaushalmodi> I faced another rST spec/parser limitation while linking something on Nim forum
14:26:53FromGitter<kaushalmodi> it's just broken
14:27:44FromGitter<alehander42> however, is this about nimdoc ?
14:28:04FromGitter<alehander42> ah, the inline docs
14:28:31FromGitter<kaushalmodi> @alehander42 yeah, the Nim doc strings and docs in .nim files in general
14:28:39FromGitter<alehander42> well honestly another idea is that
14:29:02FromGitter<alehander42> people who like markdown can write their inline docs in markdown and maintain their own markdoc
14:29:19FromGitter<alehander42> and offload all this to a 3rd party lib competition
14:29:25FromGitter<alehander42> the capitalist way
14:29:46FromGitter<alehander42> i really have to wrtie this "the language is a central goverment" essay
14:30:11FromGitter<timotheecour> > and docs in .nim files in general ⏎ ⏎ and all the ones in doc/*.rst (for which I have a WIP PR for automated conversion)
14:30:21*endragor quit (Ping timeout: 252 seconds)
14:32:46*Stiggis quit (Quit: Leaving)
14:33:17dom96_wFunnily enough I think the verbose "code-block" syntax that rST uses has a strong chance of pushing people towards using `runnableExamples`, sounds like a win to me :P
14:34:36FromGitter<kaushalmodi> I agree that `runnableExamples` is an awesome feature
14:34:49FromGitter<timotheecour> Oh ya, regarding that: saw some cases (ok my bad, some are from my PRs) where the code isn’t even shown at all because of missing newlines before/after teh code-block in rst
14:34:55FromGitter<kaushalmodi> It needs to be discussed that's the alternative to that in the Markdown world
14:35:48FromGitter<kaushalmodi> would be good to concentrate these points in that markdown RFC
14:47:18*rockcavera joined #nim
14:47:49FromGitter<arnetheduck> the whole point with moving from nim-rst is to avoid all the downstream work that people have to do to get a minimally acceptable experience with the docs - so they can spend time on working on nim instead of yet another shit format for text that nobody else is interested in..
14:50:28FromGitter<arnetheduck> the technical reasons are completely uninteresting - the fact that rst has some more features doesn't matter the least - it's a dead format because it's too strict and complicated for what is essentially meant to be unstructured - if structure is needed, you might as well write code, not prose
14:52:12FromGitter<arnetheduck> editors, site generators, jupyter notebooks, everything needs to support the weird and quirky nim-rst, that's an incredible amount of work compared to what porting the (barely) existing docs found in current nim source code
14:53:52FromGitter<kaushalmodi> As an aside, `dumpLisp` gives a non-lispy output; it has commas in there
14:54:27FromGitter<kaushalmodi> Araq: If you are fine, I can work on making that output more lisp like.
14:54:55*sagax_ quit (Quit: Konversation terminated!)
15:01:12FromGitter<kaushalmodi> Araq: Here is the current output of an example `dumpLisp`: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd1dab882893a2f3b3abbef]
15:02:00FromGitter<alehander42> wait until somebody defines scheme macros for all of those and runs nim code on scheme
15:02:41noonienhello folks!
15:02:55noonienhow do i create a nim library that compiles to an .so?
15:03:10noonieni've called `nimble init` and initialized the packages a a lib
15:03:17noonienbut don't really know where to go from here
15:03:23nooniennibmle build says i need to specify a bin
15:03:47enthus1astnoonien, nim c --app:lib code.nim
15:03:57FromGitter<kaushalmodi> noonien: you cannot "build" a lib
15:04:20noonieni see, so i only use nimble for package management?
15:04:45enthus1astnimble is also a task runner
15:05:00noonienoh, right, i remember
15:05:18noonienforgot about that, i've tried using nimble a few times now over the years
15:07:22noonienthanks!
15:07:33*narimiran quit (Ping timeout: 252 seconds)
15:07:55*narimiran joined #nim
15:14:24*krux02 quit (Remote host closed the connection)
15:15:20FromGitter<mratsim> can’t use use a nimble build task that does nim c —app:libfoo my lib.nim?
15:15:26FromGitter<mratsim> can’t you use*
15:16:30FromGitter<mratsim> ah, it should be part of nimble install, I wonder if we can deploy shared lib with nimble install
15:28:06*darithorn joined #nim
15:33:10*rokups quit (Quit: Connection closed for inactivity)
15:40:49FromGitter<kaushalmodi> @mratsim It was you who let me know about the existence of `dumpLisp`
15:41:04FromGitter<kaushalmodi> I used it today, and didn't find the output too lisp, so here's a PR https://github.com/nim-lang/Nim/pull/9515
15:46:38FromGitter<mratsim> I don’t speak Lisp so i can’t review :P
15:53:18*hagna joined #nim
15:57:38*dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:02:10*dom96_w joined #nim
16:06:22*dom96_w quit (Client Quit)
16:08:46*floppydh quit (Quit: WeeChat 2.2)
16:09:45*kapil____ joined #nim
16:10:40*dom96_w joined #nim
16:11:46*Trustable joined #nim
16:19:47*UNIcodeX joined #nim
16:27:16*jjido joined #nim
16:37:03*jacereda joined #nim
16:38:14jaceredahi... silly question, what would be the idiomatic way to translate a python dictionary comprehension?
16:39:27narimiranjacereda: nice one! i haven't tried it, but i would try to do it with `map`
16:39:56jaceredanarimiran, keep in mind a dict comprehension can include a filter operation...
16:40:26narimiranjacereda: i'll try to make an example, and if i succeed i'll get back to you
16:40:40jaceredanarimiran, ok, thanks
16:42:19*enthus1ast quit (Ping timeout: 250 seconds)
16:43:20narimiranbut in the mean time, for-loop and `if` are probably your best bet. not even nearly as elegant, but it is at least simple
16:44:14jaceredanarimiran, I was looking for some inliner that could be sold as 'look, not that bad'
16:44:19jaceredas/inliner/oneliner
16:44:50FromGitter<kaushalmodi> jacereda: Do you have a small python example of what you want to do?
16:44:54narimiranjacereda: well, even list comprehensions are ugly (IMO) in nim
16:45:23narimiran@kaushalmodi `{k: k**2 for k in range(5)}`
16:45:52FromGitter<kaushalmodi> isn't that `mapIt`?
16:46:15FromGitter<alehander42> notice `k: v`
16:46:24FromGitter<alehander42> it creates a dict
16:46:37FromGitter<alehander42> with the new forloop macros we can do something like
16:46:40FromGitter<alehander42> `let c = (for t in comp(b): (if true: {v: y}))`
16:46:53FromGitter<alehander42> but it's a little bit weird, because we need the `()` around `if`
16:46:59FromGitter<kaushalmodi> ok, I will just observe this discussion silently (new thing to learn)
16:47:07jaceredaSomething like the example in py2nim: {k + 2: v - 2 for k, v in a.items()}
16:47:31jaceredasorry,
16:47:33jacereda{k + 2: v - 2 for k, v in a.items() if k == 0}
16:48:12narimiran@kaushalmodi: btw, python has also set comprehension, which i also miss in nim :'(
16:48:14FromGitter<alehander42> wait for a minute
16:50:25narimiran(everybody is waiting)
16:50:52FromGitter<kaushalmodi> @alehander42 no pressure
16:59:47*jjido quit (Ping timeout: 240 seconds)
17:01:31*dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:02:00planetis[m]list comprehesions are weird, especially in python. i could never understand their meaning
17:02:57jaceredaplanetis[m]: I could agree, but I'm thinking about transpiling a large project with lots of those
17:03:55planetis[m]from python?
17:05:13jaceredayes
17:06:22planetis[m]nice, does python-nim work or will you do it manually with some regex?
17:07:33jaceredaI didn't know about python-nim, I'm looking at py2nim
17:07:50jaceredaurl?
17:08:13planetis[m]yes that one
17:08:16planetis[m]sry
17:08:37narimiranplanetis[m]: it's not that weird. you start with the 'body', and after that everything is like it would be in multiple lines
17:09:10planetis[m]exactly my point :)
17:10:07narimiranwell, the most important part/information is in front, i think that's a good idea
17:10:54planetis[m]so is this new list comprehensions that look like linq?
17:11:01planetis[m]actually I like them
17:11:13planetis[m]its python that i can stand
17:11:25planetis[m]*can't
17:11:52narimiranlol, ok
17:12:22*dorelix joined #nim
17:13:09jaceredathe fact is this is my first day with nim and I was quite happy to find py2nim... after some problems I finally managed to fix the build, but I'm having problems with the dict comprehension
17:13:55jaceredaIMHO having py2nim in good shape would be a good thing for the language
17:15:36narimiranjacereda: i wouldn't rely solely on py2nim no matter how good it was. it can help you by speeding up some translations, but i would still change some things manually
17:15:37FromGitter<kaushalmodi> jacereda: In case you haven't, it would help to open an issue on py2nim repo and explaining your dict comprehension use case; with an example of python snippet
17:15:46planetis[m]its a good thought, but there seems there is no interest in it. last commit was from january
17:16:11FromGitter<kaushalmodi> nevertheless, it doesn't hurt
17:16:27FromGitter<kaushalmodi> may be someone in the same situation as yours comes by that issue, and has something to share
17:16:49narimiranjacereda: i've started with nim by manually translating my python code. and sometimes nim was just 2x faster. until i've learned to do things more idiomatically, and boom: 30x speedup!
17:17:56FromGitter<kaushalmodi> ah! @alehander42 is the dev of that project :)
17:18:20jaceredaI'll send a PR to the repo, but I wanted to fix the dict comprehension first
17:19:06*dorelix quit (Quit: Leaving)
17:19:13narimiranas i said some half an hour ago: manually looping might be your safest bet :)
17:20:13planetis[m]so the ForLoopStmt will allow to rewrite the code to: ``let t = (var temp: seq[int]; for i in 0 .. 2: temp.add i; temp)`` is that correct?
17:21:16planetis[m]if so it looks like there is a copy
17:22:23planetis[m]ofc with destructors that wouldn't be an issue
17:22:48jaceredaIs ForLoopStmt some node in the AST or something?
17:23:08planetis[m]no actually
17:23:15planetis[m]i think its magic
17:23:41*dorelix joined #nim
17:23:56jaceredaok, I'll try to go that route
17:24:00jaceredathanks
17:26:07planetis[m]jacereda: you will write a lc macro yourself, even though you just started with nim?
17:27:32FromGitter<kaushalmodi> jacereda: In case you go down the `lc` route, I have some notes on that: https://scripter.co/notes/nim/#list-comprehension
17:29:16jaceredaplanetis[m]: I won't if anyone else does it for me ;) Is it that hard? I just need something like filterTable() and mapTable()
17:30:26FromGitter<Vindaar> you could base your custom `lc` on this: https://github.com/nim-lang/Nim/blob/devel/tests/macros/tcollect.nim
17:30:51planetis[m]it is yes; personally i write only procedural code but there is the `sequtils` module which have functional style procs
17:31:38FromGitter<mratsim> Nim has For Expression now which the list comprehensions should use soon (but it’s a hidden feature once again :P)
17:32:16planetis[m]weird the example Vindaar posted doesn't use `ForLoopStmt` i am confused
17:33:17FromGitter<mratsim> ah @alehander42, regarding the “leaf expressions” I talked yesterday, I wonder what this new `nnkStmtListExpr` NimNode is ;)
17:36:34planetis[m]they're both ForStmt, what is the hidden feature?
17:37:18FromGitter<mratsim> for expressions return a container
17:37:38FromGitter<mratsim> for statements return nothing
17:39:17jaceredaso, would it be better to modify https://github.com/metacraft-labs/py2nim/blob/b627eda8bcb57ded3aaacb673fc975a2f008f268/compiler.nim#L1212 to emit a for loop instead of trying to implement macros for mapTable()/filterTable()?
17:39:58jaceredas/for loop/for expression
17:40:21FromGitter<mratsim> Or you can use either zero-functional (https://github.com/zero-functional/zero-functional) or loop-fusion (https://github.com/numforge/loop-fusion)
17:41:03FromGitter<mratsim> note that if you manage to generate {0: “foo”, 1: “bar”} with macro you can then use totable on it to construct your table.
17:41:40FromGitter<mratsim> disclaimer @alehander42 the author of Py2Nim is also the author of zero-functional, and I’m the author of loop-fusion.
17:41:56planetis[m]mratsim: thx i will try to understand it with examples
17:42:14FromGitter<mratsim> And py2nim was used to kickstart production code: https://github.com/status-im/nimbus from https://github.com/ethereum/py-evm
17:43:01FromGitter<mratsim> @planetis to be honest, I didn’t try for expressions yet so I understand the theory but I didn’t try using them yet.
17:43:20Araqjacereda, py2nim suffers from a lack of resources, but not from a lack of interest :-)
17:43:37planetis[m]once i tried py2nim, and it wouldn't generate code for functions that are not called
17:43:48FromGitter<mratsim> dead call elimination :P
17:44:09Araqand since it uses the compiler API to render the Nim code, at least that part gets better as a side effect of us improving Nim's compiler...
17:45:51planetis[m]so is it easier to change py2nim or make a maptable macro, (i wasn't the one asking just curious :p)
17:47:01AraqI wish I could py2nim a try but I should work on Nim :-)
17:47:30Araqthe concept it uses is pretty cool
17:47:35FromGitter<alehander42> ok @jacereda @kaushalmodi I made a small lib for ForLoop macro-based comprehensions
17:47:52FromGitter<alehander42> stuff like `let f = (for k, v in comp(a): (if k == v: {k: v}))` or `let e = (for k, v in comp(a): (if k == v: {k}))` works now
17:48:10narimiranwhat is `comp`?
17:48:35FromGitter<alehander42> a comprehension macro (it seems one needs this to have a ForLoop macro)
17:48:53FromGitter<alehander42> the only problem is the initTable/initSet stuff uses an anon proc right now because I am not sure how else to load their types
17:49:17FromGitter<alehander42> I think I had an approach which should be DCE-d on runtime, but for some reason it's not
17:50:11FromGitter<alehander42> (I generate ⏎ ⏎ ```# def of `e` ⏎ var unused = `e`() ⏎ var `compResult` = initSet[unused.type]()``` ⏎ ⏎ and `e` is not used anywhere else, but it's not eliminated: Araq, is something like that possible? [https://gitter.im/nim-lang/Nim?at=5bd2025364cfc273f92479e2]
17:52:39Araqwhat's wrong with type(e())[0] ?
17:53:17AraqI added a typeof extension for this to work, but my testing only covered tcollect.nim
17:53:53FromGitter<alehander42> ahh I have to try that
17:54:14FromGitter<alehander42> I guess `type(e)[0]` ?
17:54:54Araqdepends on what 'e' is
17:55:29jaceredaalehander42, where's that lib?
17:56:03FromGitter<alehander42> `e` is a proc
17:56:04FromGitter<mratsim> in his head :P
17:56:37FromGitter<alehander42> @jacereda I just wrote it, fixing something and I'll publish it
17:56:58jaceredaok, thanks
18:00:09planetis[m]so the lib alehander wrote uses ForLoopStmt whereas tcollect.nim uses for expressions. that was confusing me
18:01:34planetis[m]it would be nicer if this special purpose macros not needed.
18:01:50planetis[m]*weren't
18:03:07FromGitter<alehander42> Araq everything I try with `type(stuff)[0]` fails with `identifier expect`
18:03:10FromGitter<alehander42> ed
18:04:19Araqgive me a gist please
18:10:37FromGitter<alehander42> https://gist.github.com/alehander42/90df2c4d8afd2f93c35ee211e91975bc
18:11:12FromGitter<alehander42> but anyway, I actually saw what you do in tcollect, I didn't have any idea `call to type with a node` works
18:11:46FromGitter<alehander42> maybe it's because I used quote, manually creating it with bindSym as in your code works
18:15:56Araqwell 'e' is a proc type and [0] is not defined for typeDesc
18:16:19*zachk joined #nim
18:18:33Araqok, what do you wanna read: An article about why exceptions are misunderstood or an article about Nim with memory regions?
18:19:16*zachk quit (Changing host)
18:19:16*zachk joined #nim
18:22:43planetis[m]my vote is exceptions
18:25:29*mosORadi joined #nim
18:25:55dom96Araq: You want me to deploy that blog article too?
18:28:01Araqsure
18:28:07Araqdom96, your vote?
18:29:41FromDiscord<treeform> can i haz blog?
18:30:23Araqslightly offtopic, any experiences with speech-to-text software?
18:31:54dom96Vote for what
18:31:58dom96link me to the irc logs if necessary
18:32:05dom96Got people over today so don't have much time
18:32:39Araqwhat do you wanna read: An article about why exceptions are misunderstood or an article about Nim with memory regions?
18:34:41dom96Can you elaborate on the first?
18:34:53dom96Are you going to be a proponent of exceptions or not?
18:38:16Araqlol, yes I will
18:42:40UNIcodeXpy2nim failing to build with some warnings. use 'parseopt' instead of parseopt2, use 'sugar' instead of future.
18:45:28dom96Araq: You will be a proponent? Your statement feels ambigous
18:45:33dom96*ambiguous
18:45:45FromGitter<alehander42> @jacereda https://github.com/alehander42/comprehension (honestly maybe `comp(for ..)` is better than `for .. in comp(..)`, not sure, i'd wait for people opinions on the api), thanks to Araq for ForLoop macros & tcollect (maybe it's better to just extend tcollect and stdlib it? )
18:49:04dom96well: exceptions
18:49:05FromGitter<alehander42> about py2nim: it's a cool idea, but it does require some more work indeed: we've been busy I guess and at least I haven't updated it for Nim 0.19 , but if people have some particular libs/examples I can take a look at low hanging fruits
18:49:09dom96as long as you're a proponent
18:49:34FromGitter<alehander42> (zero-functional is maintained by @michael72 these days )
18:51:43UNIcodeXI'm new to Nim. What does this mean? tracer.nim(9, 9) Hint: simpleGetOrDefault(typ, "kind") --> 'getOrDefault(typ, "kind")' [Pattern]
18:53:03UNIcodeXlooking at the line mentioned in that file, there is no "simpleGetOrDefault" or "getOrDefault". I only see: if typ{"kind"} == nil
18:54:29jaceredaalehander42: nice... I think I'll just implement filterTable()/mapTable() for the PR because it looks simpler, but I think your library will help with the objections I'll get from the python front
18:59:47shashlickwe can save ~1.5 minutes by caching built csources in nim builds - is it worth it to consider this in appveyor/travis
19:00:09planetis[m]alehander42: what type does your macro return for the two examples you posted?
19:00:49FromGitter<alehander42> @jacereda what kind of code do you want to port?
19:01:32FromGitter<alehander42> @planetis[m] well basically if your body is `{expr: expr}` it builds a table, if it's `{expr}` it builds a set and if it's something else, it builds a seq
19:02:04planetis[m]thx
19:03:27FromGitter<alehander42> honestly we can have a better syntax I think
19:03:28FromGitter<alehander42> e.g.
19:03:39FromGitter<alehander42> ```let z = comp{for k, v in a: k: u} ⏎ ``` [https://gitter.im/nim-lang/Nim?at=5bd2138b3844923661995b92]
19:03:54FromGitter<alehander42> for tables or ⏎ ⏎ ```let z = comp{for k, v in a: k}``` [https://gitter.im/nim-lang/Nim?at=5bd2139ac08b8b306770c212]
19:03:56FromGitter<alehander42> for sets
19:04:37FromGitter<alehander42> the set one looks very similar to python and most importantly you can still use comprehensions to build a seq of sets this way (because `{k}` is not special)
19:04:49FromGitter<alehander42> the table one might be confusing tho
19:04:59FromGitter<kaushalmodi> shashlick: I was thinking of actually caching just the csources built nim binary
19:05:08FromGitter<kaushalmodi> that should be enough I think
19:05:29jaceredaalehander42: it's a propietary product that is now using an extended python2, but it has reached the limits of what you should do without a decent type system (and current performance sucks TBH)
19:05:37FromGitter<kaushalmodi> (I do that locally; I don't build csources if nim binary is present)
19:06:25Araqdom96: I will argue for exceptions, yes
19:07:52shashlick@kaushalmodi: I agree - and can just do a git pull on the cached code and if that returns any changes found then do the rebuild
19:08:11shashlickright now the build.sh isn't smart enough to only recompile changed files
19:08:20shashlickif we moved that into a makefile, it would do it automatically
19:08:21FromGitter<alehander42> or even use `~` instead of comp and just have ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd214a5ef4afc4f28cf31d1]
19:08:39shashlickbut for the amount of time savings, it isn't worth it
19:08:52FromGitter<alehander42> but i guess people would hate another `~`
19:17:35FromGitter<kaushalmodi> @alehander42 I like the descriptive `comp`
19:18:23planetis[m]jacareda: take a look at this: https://gist.github.com/b3liever/15968fb7e5ae0b414857360ac930c4e8
19:19:08planetis[m]jacereda: ^
19:21:09FromGitter<rayman22201> @Araq can Haz both articles? Lol
19:22:39FromGitter<alehander42> Araq I like the memory region blog idea, much more exotic :D
19:23:57FromGitter<alehander42> @jacereda I see, it's a good time to change indeed, Python2 is close to end of life afaik
19:25:00FromGitter<alehander42> @kaushalmodi do you have pref between `comp(for ..)` and `(for .. in comp() )`
19:40:58Araqcomp(for ...) is better
19:42:36FromGitter<kaushalmodi> @alehander42 I don't have a preference, but `comp(for ..)` is shorter
19:44:36narimiranone more vote for comp(for ...)
19:47:18FromGitter<alehander42> @planetis[m] lcSet is pretty good too
19:47:52FromGitter<alehander42> I think your code is better than mine, but we still need a `k: v` special treament for tables (and generalization for comp)
19:48:40*xet7 quit (Remote host closed the connection)
19:48:45FromGitter<timotheecour> @araq not sure how feasible is your comment: https://github.com/nim-lang/Nim/pull/9510#issuecomment-433031254 the only “global” access in nimpretty.nim is via ``ConfigRef`` ; and that is defined in options.nim anyways, so I don’t see how else to do what you suggest
19:50:16planetis[m]The code comes from tcollect, it just edited to do initSet
19:51:03*stefanos82 quit (Quit: Quitting for now...)
19:51:30FromGitter<alehander42> that's a good idea indeed, do you want to generalize it further?
19:52:51FromGitter<alehander42> otherwise `comp(for ..)` remains, but then does anybody prefer ⏎ `comp{for .. expr}` vs `comp(for .. {expr})` and ⏎ `comp{for .. expr: expr}` vs `comp(for .. {expr: expr})`
19:53:07planetis[m]I could, don't you want to do it? :D You have already written a similar macro, if you have no time I will do it
19:53:29FromGitter<alehander42> the first style seems a bit more flexible, as we can later add `comp[..]` for e.g. arrays
19:53:30planetis[m]eventually
19:53:33*xet7 joined #nim
19:54:04planetis[m]but do these special syntaxes valid
19:54:19FromGitter<alehander42> @planetis[m] I can do it too, just if you're interested you can also do it
19:54:21planetis[m]sorry, are these valid?
19:54:37FromGitter<alehander42> I think so, I know that one can override `{}`
19:55:41planetis[m]no not really, i am very tired
19:55:49narimiran`comp( {for ... expr} )` for set comprehension, `comp ( [for ... expr] )` for list/seq/array comprehension
19:56:34narimiranhmmm, maybe we can lose parantheses and just have whitespace? `comp {for ... expr}` and `comp [for ... expr]`
19:56:58FromGitter<alehander42> yes space works
19:57:15FromGitter<alehander42> but I am afaid people will easily make a mistake and miss it
19:57:32*jacereda quit (Ping timeout: 246 seconds)
19:58:06UNIcodeXI have cloned Nim, built it using the instructions on github, cloned py2nim, followed its instructions to build, and I get errors. Even after making changes to the imports that it suggests. I do not know what to do with the hint about simpleGetOrDefault(typ, "kind") --> 'getOrDefault(typ, "kind")' [Pattern]. Will someone PLEASE help?
19:58:36narimiranif both space and parentheses work (like they do for a single parameter procs) then i don't see a (big) problem
19:58:46FromGitter<alehander42> @planetis[m] @narimiran yeah the `comp{..}` works with overriding `{}`
19:59:03FromGitter<alehander42> the problem is .. it's hard to make it work with the normal macro (space)
19:59:17FromGitter<alehander42> because I need to have both `comp` macro and `comp` global var
19:59:20FromGitter<alehander42> which seem to clash :D
19:59:29narimiranif it was easy, i would do it ;)
19:59:59FromGitter<alehander42> @UNIcodeX ignore this hint, it's about an autogenerated code, it doesn't really matter
20:00:03FromGitter<alehander42> for your usage
20:00:39planetis[m]what is it for, the `comp` global var
20:01:16FromGitter<alehander42> because I need to be able to override `{}`
20:01:18UNIcodeX@alehander42, OK. thanks. I guess the real error is "cannot open file: compiler/ast"
20:01:19FromGitter<alehander42> I think
20:01:30*xet7 quit (Remote host closed the connection)
20:01:34FromGitter<alehander42> @UNIcodeX py2nim isn't up to date for Nim 0.19 sadly
20:01:42FromGitter<alehander42> I can try to take a look at it tomorrow
20:02:51UNIcodeXI have a web scraper that uses selenium. It runs in parallel using Python's multiprocessing.Pool. Currently the scraper runs at a rate of 1.75 seconds per page. I may not be able to make it go any faster, but I'm trying to see about learning Nim by porting it over. I thought py2Nim would be a good starting place.
20:03:00UNIcodeX@alehander42^
20:03:35UNIcodeX@alehander42 https://hastebin.com/oqahilunox.py
20:03:44FromGitter<mratsim> selenium is basically launching long-lived chrome instances
20:03:50FromGitter<mratsim> your bottleneck is Chrome not Python
20:03:59FromGitter<mratsim> and maybe the captchas
20:04:59UNIcodeX@mratsim And I figure as much, but would still like to port either it or something to learn Nim. Another reason is distribution of an executable. Nuitka is failing to build with some error about a filename being to long.... :scratches head:
20:05:24FromGitter<alehander42> @mratsim is right, but if you want to try Nim, that's great
20:05:44FromGitter<alehander42> well, py2nim needs to be updated, so you might want to directly start with Nim for now, I am sorry
20:05:52UNIcodeXI'm also having trouble building Aporia on my work machine. Sadly it's Winders
20:05:59UNIcodeXIt built perfectly on my Arch install.
20:06:04UNIcodeXat home
20:06:07FromGitter<mratsim> ah Python distribution, always lovely: https://xkcd.com/1987/
20:06:31FromGitter<mratsim> Use Vscode, I’m not even sure dom96 is updating it
20:06:49FromGitter<alehander42> yes, nim has ok plugins for most common editors
20:06:57FromGitter<alehander42> people also use sublime, vim
20:07:02narimiranUNIcodeX: AFAIK aporia is not maintained anymore, most of us use VSCode
20:07:05FromGitter<alehander42> emacs
20:08:41UNIcodeXI'll check out VSCode. I'm more used to vi for general text editing. and PyCharm for Python, which has really spoiled me on IDEs
20:09:34FromGitter<mratsim> lots of dev are using vi, check maybe zah’s plugin
20:09:48FromGitter<mratsim> it works with nimsuggest AFAIK
20:10:08FromGitter<alehander42> well, I hope one day we get a jetbrains ide too
20:10:30FromGitter<mratsim> I hope we can replace java :P
20:10:40UNIcodeXtheir IDEs are top notch for sure.
20:10:43FromGitter<alehander42> I wonder what name would they decide on
20:10:55FromGitter<mratsim> Sunrise?
20:11:33*nsf quit (Quit: WeeChat 2.2)
20:11:39UNIcodeXIf memory serves, Armin Ronacher, who created the werkzeug and Flask web application libraries for Python, works for JetBrains
20:11:58UNIcodeXmaybe he could be made interested in Nim
20:13:20FromGitter<alehander42> @mratsim I expect something like a SpaceNimBear
20:13:39FromGitter<alehander42> yeah, he seems like a cool guy
20:14:05FromGitter<kaushalmodi> Anyone knows how to write Nim equivalents of these JS snippets
20:14:17FromGitter<kaushalmodi> https://functions-playground.netlify.com/
20:14:51FromGitter<kaushalmodi> plan is to then have Nim -> JS -> Netlify Lambda functions
20:14:53*xet7 joined #nim
20:15:11*Trustable quit (Remote host closed the connection)
20:15:21UNIcodeXVSCode looks neat.
20:15:49UNIcodeXplugin management within app. 30k plus installs of Nim plugin.
20:16:24FromGitter<alehander42> @kaushalmodi you can do them kinda easily, in my code I have macros for export, but one could go on without them too
20:17:56FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd224f4271506518d6d4352]
20:18:04FromGitter<alehander42> not tested
20:18:05*vlad1777d_ joined #nim
20:18:20FromGitter<kaushalmodi> @alehander42 let me try that out; thanks!
20:19:05FromGitter<alehander42> the querystring thing I am not sure about: is it coming from their lib?
20:19:24FromGitter<kaushalmodi> I honestly have no idea
20:19:33FromGitter<kaushalmodi> I know just Nim and nothing about JS
20:19:34FromGitter<alehander42> also, not entirely sure if anon async procs work (normal async procs work), but it should be possible eventually
20:19:39FromGitter<alehander42> ah ok :D
20:20:19FromGitter<kaushalmodi> that's why, if someone has an a to b association table between Nim and those JS snippets, I think I can start using Netlify functions
20:20:20FromGitter<kaushalmodi> :)
20:22:54FromGitter<kaushalmodi> @alehander42 that snippet doesn't work: ⏎ ⏎ > Error: ':' or '=' expected, but got 'exports'
20:23:45*narimiran quit (Quit: Konversation terminated!)
20:25:42FromGitter<rayman22201> long shot, but try `var exports : js {.importc.}`
20:26:37FromGitter<rayman22201> I have JS experience, and Nim experience, but I've never heard of netlify :/
20:26:59FromGitter<kaushalmodi> Netlify is a service for deploying static sites
20:27:07FromGitter<kaushalmodi> I deploy my Hugo site using them (free)
20:27:20FromGitter<rayman22201> ah. ok
20:27:21FromGitter<kaushalmodi> btw adding that `: js` type also didn't work
20:27:30FromGitter<kaushalmodi> *never seen that type*
20:28:18FromGitter<rayman22201> it's part of the js ffi: https://nim-lang.org/docs/lib.html#pure-libraries-modules-for-js-backend
20:28:41FromGitter<rayman22201> specifically this type: https://nim-lang.org/docs/jsffi.html#JsObject
20:29:03FromGitter<rayman22201> importing the jsffi module might help also
20:33:41UNIcodeXany idea why VSCode wouldn't be able to find nim on the path, when I've verified that it's the first entry in the path and that I can run it without the full path in powershell and cmd?
20:34:25FromGitter<kaushalmodi> @rayman22201 Adding `import jsffi` worked; it compiled, but the code is https://ptpb.pw/eHda/js
20:34:50*mosORadi quit (Quit: Connection closed for inactivity)
20:34:54FromGitter<kaushalmodi> it doesn't have the `exports.handler` that I have in the expected code: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd228ee64cfc273f9257fff]
20:35:14FromGitter<rayman22201> it's getting name mangled.
20:35:31FromGitter<kaushalmodi> yeah.. I get `exports_319014[0].handler`
20:35:44FromGitter<kaushalmodi> so that might not work.. or would it?
20:35:57FromGitter<rayman22201> would not work. something is amis
20:36:29FromGitter<rayman22201> It's missing something... hrmmm....
20:36:35FromGitter<kaushalmodi> here is the nim code that generated that: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd22952435c2a518e0511aa]
20:37:19FromGitter<rayman22201> oh, you need the '{.importc.}` part still
20:37:33FromGitter<rayman22201> `var exports: js {.importc.}`
20:38:15FromGitter<kaushalmodi> but then I get: ⏎ ⏎ > hello.nim(3, 17) Error: invalid indentation
20:39:10FromGitter<kaushalmodi> That *(3, 17)* is pointing at the `.` before `importc` in `var exports: js {.importc.}`
20:40:08FromGitter<kaushalmodi> this worked!
20:40:13FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd22a2c1e23486b9319a0df]
20:40:30FromGitter<kaushalmodi> needed to have that pragma between var and type
20:40:56FromGitter<rayman22201> ah. ok. I don't use pragmas on vars like that often. good catch.
20:41:06FromGitter<kaushalmodi> and here's the generated JS:https://ptpb.pw/Pr84/js
20:41:07FromGitter<rayman22201> That should probably be in the manual... or noted somewhere lol
20:41:10FromGitter<kaushalmodi> now trying it out
20:42:30FromGitter<rayman22201> If you want to use the async stuff, remember to use https://nim-lang.org/docs/asyncjs.html to get the js version of the async macro.
20:44:55FromGitter<kaushalmodi> cool! still working on getting a toy repo out with just that hello.js
20:46:33UNIcodeXI _REALLY_ am liking the code introspection in VSCode!
20:46:44UNIcodeXThe documentation in the .nim files is excellent!
20:46:56FromGitter<rayman22201> @kaushalmodi :fingers crossed: should work like a charm :-P
20:48:02FromGitter<alehander42> @UNIcodeX yeah that feature is cool indeed!
20:48:17FromGitter<alehander42> @kaushalmodi yeah, sorry about that it seems ok now
20:48:20FromGitter<rayman22201> @UNIcodeX using VSCode plugin powered by nimsuggest? That's great to hear.
20:48:45FromGitter<alehander42> for interpolation you can have cstring(&"..{name}")
20:48:54FromGitter<alehander42> i use `j` instead of cstring in my code
20:48:59FromGitter<alehander42> but its not in the stdlib
20:49:12FromGitter<alehander42> (but its useful as you can have a lot of j"..." in such an app)
20:49:53UNIcodeX@alehander42, @rayman22201, indeed! :)
21:18:09FromGitter<kaushalmodi> @rayman22201 @alehander42 thanks guys! it works!
21:18:11FromGitter<kaushalmodi> https://unruffled-heisenberg-ebee10.netlify.com/
21:18:23*vlad1777d_ quit (Ping timeout: 246 seconds)
21:18:25FromGitter<kaushalmodi> Click on *Say hello*
21:21:53*jacereda joined #nim
21:23:21FromGitter<kaushalmodi> here's a bare bones repo: https://github.com/kaushalmodi/nim-netlify-functions -> https://nim-lambda-functions.netlify.com/
21:29:41jaceredais `k:v` some magic to create a `KeyValuePair`? If so, why isn't `KeyValuePair` public?
21:32:35*druonysus joined #nim
21:32:36*druonysus quit (Changing host)
21:32:36*druonysus joined #nim
21:46:13FromGitter<alehander42> @jacereda I think it's an implementation detail, it doesn't have builtin meaning outside of table literals
21:48:14*ghost64 quit (Quit: See you!)
21:48:36*ghost64 joined #nim
21:50:06FromGitter<kaushalmodi> Any idea how to convert this from JS to Nim? `const name = event.queryStringParameters.name || "World";`
21:50:17FromGitter<kaushalmodi> The `|| "World"` is understood
21:50:33FromGitter<kayabaNerve> That's the part I was going to offer help with D:
21:50:34FromGitter<kaushalmodi> but the challenge is converting `event.queryStringParameters.name` to string
21:50:36jaceredaso, what would I use to give a type to `mapTable` in something like `tab.mapTable(k + 2: v - 2)`?
21:50:59FromGitter<kayabaNerve> I thought I could help but nope. Sorry @kaushalmodi :P
21:51:08FromGitter<kaushalmodi> the type of that `event. ..` is `JsObject`
21:51:13FromGitter<kaushalmodi> @kayabaNerve no worries :)
21:51:27FromGitter<kayabaNerve> I'm pretty sure it's via `["` `"]`
21:52:36FromGitter<kayabaNerve> And then you'd do `.to(cstring)` or `.to(string)` on the final JSObject as `[]` returns another JSObject
21:52:53FromGitter<kayabaNerve> That's what the `jsffi` docs say 0_o
21:53:10FromGitter<kayabaNerve> ... there's also the emit pragma /s
21:53:15jaceredaor should I just use `tab.mapTable((k+2,v-2))` instead?
21:53:15FromGitter<rayman22201> I think you are spot on @kayabaNerve
21:53:26FromGitter<kayabaNerve> Validation :D
21:53:51*xet7 quit (Quit: Leaving)
21:53:55FromGitter<kayabaNerve> I haven't used the JS backend but I've used the JSON lib and grabbed `.to` from the `jsffi` docs.
21:55:08FromGitter<kaushalmodi> thanks @kayabaNerve, I at least got it compiling
21:55:25FromGitter<kaushalmodi> converted https://ptpb.pw/Ingo/js to https://ptpb.pw/t9JY/nim
21:55:51FromGitter<kayabaNerve> Nice
21:56:13FromGitter<kayabaNerve> Who wants to try getting my code up on the JS backend? :P
21:56:18FromGitter<rayman22201> I believe jsffi has an experimental `.` macro to let you access js objects like you would regular objects. idk how well it works though
21:56:26FromGitter<kayabaNerve> I only use multiple C and one C++ library :P
21:57:44*flaviu quit (Read error: Connection reset by peer)
21:57:54FromGitter<kaushalmodi> lol, not surprised that that code didn't work right away.. seemed too good to be true
21:58:02FromGitter<kaushalmodi> https://nim-lambda-functions.netlify.com/ see the 3rd code snippet
21:58:42FromGitter<kaushalmodi> I get: ⏎ ⏎ > {"errorMessage":"URI malformed","errorType":"URIError","stackTrace":["decodeURIComponent (<anonymous>)","toJSStr (/var/task/hello_name.js:169:31)","inner_463114 (/var/task/hello_name.js:251:21)","HEX3Aanonymous_463055 (/var/task/hello_name.js:275:19)"]}
21:59:48FromGitter<rayman22201> seems like a netlify error more than a nim js error
22:01:28FromGitter<kaushalmodi> hmm, oh well. Though, I am excited to see hello.nim and hello_async.nim work
22:01:57FromGitter<kaushalmodi> *first time seeing JS code indirectly created by me work*
22:02:36FromGitter<rayman22201> lol. awesome!
22:02:44FromGitter<rayman22201> when name = "" it works
22:02:49FromGitter<rayman22201> which is interesting
22:03:50FromGitter<rayman22201> `https://nim-lambda-functions.netlify.com/.netlify/functions/hello_name?name=` works
22:04:10FromGitter<kaushalmodi> oh nice!
22:04:13FromGitter<kaushalmodi> :P
22:04:43FromGitter<rayman22201> and `decodeURIComponent` is a js built in function, so I'm curious what that function is getting as input
22:04:47FromGitter<kaushalmodi> so somehow `event.queryStringParameters.name` part is not working
22:05:10FromGitter<kaushalmodi> this is the nim generated JS: https://nim-lambda-functions.netlify.com/lambda/nimcache/hello_name.js
22:05:38FromGitter<kaushalmodi> I see `var name_463107 = (event_463057.queryStringParameters.name);`
22:05:59FromGitter<kaushalmodi> does that look right?
22:11:06FromGitter<rayman22201> yes. Looking through the generated code... always ugly lol
22:11:53FromGitter<kaushalmodi> I got it to work!
22:12:13FromGitter<rayman22201> oh cool. What is the secrect?
22:12:13FromGitter<kaushalmodi> seems like I cannot ever let become "Nim strings"
22:12:15FromGitter<kaushalmodi> https://github.com/kaushalmodi/nim-netlify-functions/commit/7c6f7cab4c45d621d148a8fa33ec6e84a4ddb738
22:12:21FromGitter<kaushalmodi> can someone explain that commit
22:12:23FromGitter<kaushalmodi> :P
22:12:41FromGitter<kaushalmodi> I just compared the hello_name.nim generated code with hello.nim generated one
22:12:57FromGitter<rayman22201> oh, I see
22:13:07FromGitter<kaushalmodi> and I saw that earlier I had a lot of Nim generated code for string -> cstring translation
22:13:21FromGitter<rayman22201> Yeah. You can let it become a Nim string, you just have to convert back again at the right places :-P
22:13:25FromGitter<kaushalmodi> in that commit, I force type to be cstring to begin with, but the Nim code is ugly
22:13:38FromGitter<kaushalmodi> .. but I was converting..
22:13:57FromGitter<rayman22201> No, if you look at the generated code, it was not
22:14:02FromGitter<kaushalmodi> I was doing `cstring("Hello, " & name & "! From Nim.")`
22:14:17FromGitter<kaushalmodi> apparently that's not enough
22:14:27FromGitter<rayman22201> Yeah, that was not converting `name` to a cstring first.
22:14:52FromGitter<rayman22201> which may be a code gen bug, maybe.... I'm not sure.
22:14:59FromGitter<kaushalmodi> if you see https://github.com/kaushalmodi/nim-netlify-functions/commit/7c6f7cab4c45d621d148a8fa33ec6e84a4ddb738#diff-29874c3599f864f516343384b07c48a3L15
22:15:01FromGitter<alehander42> this should work for sure
22:15:06FromGitter<kaushalmodi> I was letting name to be string
22:15:07FromGitter<alehander42> cstring(&"Hello {name}") too
22:15:11FromGitter<kaushalmodi> then concat everything to string
22:15:20FromGitter<kaushalmodi> and then do `cstring(..)` on that whole bunch
22:15:25FromGitter<kaushalmodi> but that didn't work
22:16:01FromGitter<kaushalmodi> @alehander42 that `&` is from strformat, right?
22:16:07FromGitter<alehander42> yes, for example
22:16:32FromGitter<kaushalmodi> @alehander42 does the above linked diff give any hint on what's wrong?
22:16:44FromGitter<rayman22201> Yeah, I would expect it to work, but looking at the generated code, you can see, just the first part gets converted and then it is incorrectly concat'ed: https://github.com/kaushalmodi/nim-netlify-functions/commit/7c6f7cab4c45d621d148a8fa33ec6e84a4ddb738#diff-71dcf605e39becd2c05534689bbe3961L251
22:16:45FromGitter<alehander42> I am not sure what's the problem
22:16:50FromGitter<alehander42> I mean what do you expect
22:16:52FromGitter<alehander42> to happen?
22:17:34FromGitter<alehander42> ah what is `to(string)`
22:19:19FromGitter<kaushalmodi> @alehander42 https://nim-lang.org/docs/jsffi.html#to%2CJsObject%2Ctypedesc
22:19:58FromGitter<kaushalmodi> @alehander42 this works: https://nim-lambda-functions.netlify.com/.netlify/functions/hello_name?name=foo
22:20:05FromGitter<alehander42> well `toJSStr((makeNimstrLit("Hello, ")).concat(name_463107,makeNimstrLit("! From Nim.")));` seems correct to me too
22:20:07FromGitter<kaushalmodi> this doesn't: https://nim-lambda-functions.netlify.com/.netlify/functions/hello_name_bad?name=foo
22:20:08FromGitter<rayman22201> interesting, it looks like to(string) isn't actually doing anything in the generated code. It's still treated as a js string: https://github.com/kaushalmodi/nim-netlify-functions/commit/7c6f7cab4c45d621d148a8fa33ec6e84a4ddb738#diff-71dcf605e39becd2c05534689bbe3961L268
22:20:18*druonysus quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
22:20:27FromGitter<alehander42> yeah not sure how well `to` works there
22:20:32*druonysus joined #nim
22:20:32FromGitter<alehander42> I usually just cast it
22:20:32*druonysus quit (Changing host)
22:20:32*druonysus joined #nim
22:20:37FromGitter<kaushalmodi> good code: https://nim-lambda-functions.netlify.com/lambda/nimcache/hello_name.js, bad code: https://nim-lambda-functions.netlify.com/lambda/nimcache/hello_name_bad.js
22:20:43FromGitter<alehander42> or use the js json
22:22:39FromGitter<kaushalmodi> btw @alehander42 @rayman22201 if you like, you can just follow the commits in https://github.com/kaushalmodi/nim-netlify-functions/tree/master/src/lambda
22:23:02FromGitter<kaushalmodi> @alehander42 how would you refactor the hello_name.nim in that dir (linked above) to use js json?
22:23:15FromGitter<rayman22201> The actual problem @kaushalmodi may be that queryStringParamter.name was not actually converted to a Nim string.
22:23:36FromGitter<kaushalmodi> hmmm
22:24:13FromGitter<alehander42> but you need to convert it to cstring
22:24:19FromGitter<alehander42> maybe
22:25:01FromGitter<rayman22201> you need to convert it to a cstring at the end. But the `to(string)` did nothing in the generated code, but the rest of the code expected it to be a Nim string.
22:25:09FromGitter<alehander42> so what is `name` ? I mean
22:25:18FromGitter<alehander42> to is not needed
22:25:29*xet7 joined #nim
22:25:31FromGitter<alehander42> because the only way it can work is on JsonNode which is created by the nim json lib
22:25:36FromGitter<rayman22201> name is a cstring (js string), but I think @kaushalmodi wanted to convert it to a Nim string
22:25:54FromGitter<alehander42> for this, you need `$event.query...name`
22:26:29FromGitter<rayman22201> `to` takes a `jsObject` not a `jsonNode`
22:26:31FromGitter<rayman22201> https://nim-lang.org/docs/jsffi.html#to%2CJsObject%2Ctypedesc
22:26:46FromGitter<rayman22201> though the json lib may have a similar method
22:26:47FromGitter<alehander42> ah, I didn't know jsffi has one too
22:26:54FromGitter<alehander42> but for sure `$` is the right thing to do
22:26:58FromGitter<alehander42> for cstring -> string
22:27:08FromGitter<rayman22201> I think you are right @alehander42. that makes sense
22:27:22FromGitter<kaushalmodi> @alehander42 that doesn't work
22:27:24FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd2434c271506518d6e07e9]
22:27:28FromGitter<alehander42> ahhh yeah `to` is a cast
22:27:37FromGitter<kaushalmodi> there isn't a `$` defined for `JsObject`
22:27:37FromGitter<alehander42> look at the source it just casts it
22:27:50FromGitter<alehander42> ah yeah because you have to tell nim its cstring
22:28:03FromGitter<rayman22201> you have to cast to a cstring, and then use `$`
22:28:03FromGitter<alehander42> so it should be `$....name.to(cstring)`
22:28:05FromGitter<alehander42> in this case
22:28:07FromGitter<alehander42> yep
22:28:20FromGitter<alehander42> or `$(..to(cstring))`
22:28:25FromGitter<rayman22201> because doing ffi is always a PITA!
22:28:26FromGitter<kaushalmodi> so JsObject -> cstring -> string?
22:28:30FromGitter<rayman22201> yup
22:28:31FromGitter<alehander42> yes
22:28:32FromGitter<dom96> https://nim-lang.org/blog/2018/10/25/hired-krux02.html
22:28:33FromGitter<kaushalmodi> huh
22:28:40FromGitter<alehander42> well, I have my own jsobject macro
22:28:48FromGitter<alehander42> which helps with this stuff, but its not in stdlib
22:29:00FromGitter<rayman22201> Awesome news! contrats @krux02 ! good choice
22:30:25FromGitter<kaushalmodi> @alehander42 That worked! Thanks! https://nim-lambda-functions.netlify.com/.netlify/functions/hello_name_2?name=foo
22:30:41FromGitter<kaushalmodi> Congrats @krux02 !
22:30:50FromGitter<kayabaNerve> Congrats krux02!
22:31:24FromGitter<alehander42> well done @krux02 good luck!
22:31:28FromGitter<alehander42> these demos are weeeird
22:31:41FromGitter<kaushalmodi> which demos?
22:32:01FromGitter<alehander42> from the article
22:32:29FromGitter<rayman22201> I call that the LSD shader :-P
22:33:19FromGitter<kayabaNerve> If you're on LSD, does it cancel out?
22:33:54*druonysus quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
22:34:54FromGitter<rayman22201> lol. You could find out 0.o
22:38:05*jacereda` joined #nim
22:38:51*kapil____ quit (Quit: Connection closed for inactivity)
22:41:07*jacereda quit (Ping timeout: 240 seconds)
22:42:33*jacereda` quit (Ping timeout: 245 seconds)
22:55:36FromGitter<timotheecour> @krux02 congrats! very glad to see the Nim team is growing
23:00:44FromGitter<kaushalmodi> Late realization, one of Nim devs is now an Emacs user. Woo! 🎉
23:03:59*xace quit (Ping timeout: 268 seconds)
23:05:31*xace joined #nim
23:06:11*so quit (Ping timeout: 246 seconds)
23:10:51*so joined #nim
23:12:43shashlickBrilliant
23:13:30FromGitter<kayabaNerve> Nano/Atom ftw.
23:17:07*druonysus joined #nim
23:17:07*druonysus quit (Changing host)
23:17:07*druonysus joined #nim
23:19:01*elrood quit (Quit: Leaving)
23:25:35*endragor joined #nim
23:29:54*endragor quit (Ping timeout: 252 seconds)
23:32:36FromGitter<zacharycarter> congrats @krux02
23:57:48*darithorn quit ()