<< 26-10-2018 >>

00:03:53*platoff quit (Read error: Connection reset by peer)
00:10:15*a_b_m quit (Ping timeout: 264 seconds)
00:21:56*zachk quit (Quit: Leaving)
00:40:49*ftsf_ joined #nim
01:27:17*dddddd quit (Remote host closed the connection)
01:44:16FromGitter<yyyc514> can i defer type evaltion of a proc that’s templated?
01:44:26FromGitter<yyyc514> it seems to not like me using properties when it doesn’t know the object in advance
01:44:33FromGitter<yyyc514> is that simply not doable?
01:54:13FromGitter<yyyc514> ie: `proc optionsT (selected: string, list: openarray[T]) : string =`
01:54:30FromGitter<yyyc514> where the thing lists have in common is a certain field
01:55:47FromGitter<yyyc514> i couldn’t get the tempalte form to work etierh but it seems like it should
02:05:04*banc quit (Quit: ZNC - http://znc.in)
02:11:53*ftsf_ quit (Quit: Leaving)
02:20:28*banc joined #nim
02:33:24*endragor joined #nim
02:39:23FromGitter<yyyc514> hmmm what would prevent nim from pegging my cpu? it’s only hitting 100% and i’m loading the server… any thoughts?
02:40:20*darithorn joined #nim
03:10:06*dorelix quit (Remote host closed the connection)
03:10:08FromGitter<rayman22201> @yyyc514 you need concepts to do the options thing you are trying to do
03:10:37FromGitter<yyyc514> actually i got it working as is
03:10:46FromGitter<yyyc514> the problem was i wasn’t exposing the property on my object *blush*
03:10:54FromGitter<rayman22201> ah, well, that will do it.
03:10:57FromGitter<rayman22201> cool
03:11:03FromGitter<yyyc514> fix that and it ran perfect
03:11:44FromGitter<rayman22201> idk abou the cpu thing. I would need more information.
03:19:53*cavariux quit (Quit: Ping timeout (120 seconds))
03:27:33*chemist69 quit (Ping timeout: 250 seconds)
03:29:18*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
03:29:44*chemist69 joined #nim
03:38:44*cavariux joined #nim
03:57:45*cavariux quit (Quit: Ping timeout (120 seconds))
03:58:12*cavariux joined #nim
03:58:38FromGitter<yyyc514> you know wouldn’t it be cool to build your whole app into one binary?
03:58:42FromGitter<yyyc514> no static assets at all? :)
03:58:50FromGitter<yyyc514> [talking about web app]
04:03:50FromGitter<rayman22201> I can't find it atm, but somebody on the forum had a similar idea and discussed some ways to do exactly that actually.
04:06:36FromGitter<rayman22201> as far as a webapp goes. js lets you embed arbitrary data if you encode it as base64. It causes terrible size bloat, but you can do it lol.
04:08:27*cavariux quit (Ping timeout: 240 seconds)
04:12:02*cavariux joined #nim
04:21:57*crem quit (Ping timeout: 252 seconds)
04:22:51*stefanos82 joined #nim
04:23:41*crem joined #nim
04:24:23FromGitter<rayman22201> found it: https://github.com/genotrance/nimdeps It's for native though. not web apps. still pretty cool though
04:29:52*darithorn quit ()
04:50:53FromGitter<bung87> where this idea come from ? I never need such a feature
04:57:07*cavariux quit (Ping timeout: 240 seconds)
05:01:43*cavariux joined #nim
05:01:51*xet7 quit (Ping timeout: 264 seconds)
05:14:01*xet7 joined #nim
05:15:27*kapil____ joined #nim
05:23:40*nsf joined #nim
05:25:14shashlickwell the initial goal was to bundle DLLs into the EXE
05:25:44shashlickbut that's not currently possible since the DLLs are loaded before I can do anything in nimdeps
05:26:30shashlickconsider it a feature for people who want everything in one exe
05:26:53shashlickmeanwhile, I think I got libgraphqlparser successfully wrapped
05:35:31FromGitter<bung87> but I never thought use some thing like that in web dev..
05:37:52shashlicksomething like Fossil perhaps - http://www.fossil-scm.org/
05:38:02shashlickor a wannabe py2exe/pyinstaller
05:40:56FromGitter<bung87> or maybe just want deliver bin file
05:43:10FromGitter<bung87> shashlick do you have ideas about vector and seq interop now?
05:45:39shashlickhaven't looked at it as of yet 😞
05:46:19*tiorock joined #nim
05:46:19*tiorock quit (Changing host)
05:46:19*tiorock joined #nim
05:46:19*rockcavera quit (Killed (kornbluth.freenode.net (Nickname regained by services)))
05:46:19*tiorock is now known as rockcavera
05:46:53FromGitter<bung87> ok, I was trying porting it to pure nim , but process not very well.
05:47:06shashlicki've taken a note now
05:47:15shashlickwhich wrapper were we working on?
05:47:30FromGitter<bung87> fasttext
05:47:42shashlickriit
05:48:05*FromDiscord_ joined #nim
05:48:25*gmpreussner_ joined #nim
05:53:02shashlickokay folks, ping if you are interested in the libgraphqlparser wrapper - need some expertise to validate that it does what it is supposed to
05:53:43*jxy_ joined #nim
05:54:32*gsingh93- joined #nim
05:54:46*Death916 joined #nim
05:54:59*Summertime2 joined #nim
05:55:51*gmpreussner quit (*.net *.split)
05:55:52*Tongir quit (*.net *.split)
05:56:09*spookydeath916 quit (*.net *.split)
05:56:09*Summertime quit (*.net *.split)
05:56:09*copygirl quit (*.net *.split)
05:56:09*FromDiscord quit (*.net *.split)
05:56:09*oky quit (*.net *.split)
05:56:09*gsingh93 quit (*.net *.split)
05:56:09*jxy quit (*.net *.split)
05:56:09*ng0 quit (*.net *.split)
05:56:09*abeaumont quit (*.net *.split)
05:56:09*gsingh93- is now known as gsingh93
06:02:27*Tongir joined #nim
06:02:52*copygirl joined #nim
06:03:26*oky joined #nim
06:03:59*ng0 joined #nim
06:04:48*xet7 quit (Remote host closed the connection)
06:11:15*m712 quit (Quit: bye-nyan!)
06:11:31*m712 joined #nim
06:16:19*krux02 joined #nim
06:17:51*Tongir quit (Remote host closed the connection)
06:28:31*krux02 quit (Remote host closed the connection)
06:39:33*krux02 joined #nim
06:41:29*smt quit (Read error: Connection reset by peer)
06:44:33*Vladar joined #nim
07:14:13*xet7 joined #nim
07:40:36*jacereda joined #nim
07:43:30*abeaumont joined #nim
07:47:10*cavariux quit (Ping timeout: 272 seconds)
07:48:13*cavariux joined #nim
08:04:42jaceredawhat am I doing wrong here? https://gist.github.com/jacereda/2461855bd1be85fe2fabdd5688d19771
08:05:19jaceredaI get: test.nim(11, 16) Error: illformed AST: proc (v: int): string = result = $v
08:12:55FromGitter<narimiran> hmmm, if you define `proc foo(v: int): string = $v`, and then do `echo a.mapVals(foo)` it works
08:13:48jaceredaso, is it a bug?
08:15:20FromGitter<alehander42> I am not sure, but overally that API would be a bit verbose
08:16:17FromGitter<alehander42> you can also have a shorter `echo a.mapVals($v)` if you define mapKeys / mapVals macros similar to mapIt/filterIt from sequtils
08:17:13FromGitter<alehander42> of course not everybody likes injected variables
08:19:16FromGitter<narimiran> here is the working version: http://ix.io/1q3L/
08:19:25jaceredaalehander42, that's another I want to implement and I don't know how to give it a good type. I tried something like `template mapVals*[A,B,C](t : Table[A,B], op : untyped): Table[A,C]`, but it doesn't compile (I guess I need some way to express the `op` returns a C)
08:19:40FromGitter<narimiran> notice that i changed `mapVals` to be a proc, not a template
08:20:08FromGitter<narimiran> style fixes: result is automatically returned, no need to be on the last line, no space before a colon
08:20:40FromGitter<narimiran> `sugar` import is not needed, that was for some my previous testing. ignore it.
08:20:45FromGitter<alehander42> @jacereda yes, but is this about the shorter `a.mapVals($v)` ?
08:20:53FromGitter<alehander42> @narimiran you also tried `->` `=>` didn't ya :D
08:20:54jaceredanarimiran: good, thanks
08:21:10FromGitter<narimiran> @alehander42 of course, that's the first thing i did :D
08:21:12FromGitter<alehander42> if it is, you need the return type to be also `untyped`
08:21:48jaceredaalehander42: let me try...
08:23:38FromGitter<alehander42> the problem is that you'll have a hard time with the `initTable` types
08:23:48FromGitter<alehander42> that's what I spent most time on in my comprehension macros
08:24:18FromGitter<alehander42> but it needs a macro, a template wouldn't be sufficient
08:25:21FromGitter<alehander42> basically there is a good solution I stole from araq's tcollect
08:25:47FromGitter<alehander42> (last two message should be in reverse order)
08:26:58Araqalehander42: have you released the code somewhere?
08:27:09jaceredaalehander42, I guess if it was possible to give a return type to the `op` it would be easy... is `untyped` the only possible type for a block?
08:27:54jaceredaMy naive attempt failed: https://gist.github.com/jacereda/350221fc6a88d2e9fc313b6537bd6aaf
08:28:09jaceredatest.nim(8, 25) Error: cannot instantiate: 'C'
08:28:34FromGitter<alehander42> Araq https://github.com/alehander42/comprehension
08:28:41FromGitter<alehander42> it's pretty ugly for now
08:29:11FromGitter<alehander42> i have to update it with the `comp(for) / comp{}` versions
08:29:45jaceredain fact, if I add a dummy parameter of type C it compiles fine
08:30:40FromGitter<gogolxdong> What does `annot create Vulkan instance. ⏎ /build/vulkan-tools-ZnxIl9/vulkan-tools-1.1.82.0+dfsg1/vulkaninfo/vulkaninfo.c:825: failed with VK_ERROR_INCOMPATIBLE_DRIVER` mean?
08:33:00FromGitter<gogolxdong> does this simpley mean my gpu doesn't support vulkan API?
08:36:08jaceredais there something like `op: block[C]` to express that a parameter is a block of code yielding a C?
08:44:26Araqgogolxdong: seems likely
08:48:03*rockcavera quit (Ping timeout: 264 seconds)
08:52:08*PMunch joined #nim
08:56:33jaceredaThis does compile: https://gist.github.com/jacereda/c5d643b9850c8d3e00f3f53897cc5e62 is there any way to implement `mapValsIt` without the `dummy` argument and without resorting to macros?
08:58:55FromGitter<gogolxdong> That's too bad.
09:00:44Araqjacereda, use proc (v: B): auto
09:05:31jaceredaAraq: do you mean in `mapVals` or in `mapValsIt`?
09:07:55jaceredain `mapValsIt` I get the `cannot instantiate: 'C'` error
09:09:01Araqin mapValsIt
09:09:08Araqyou don't need the generic 'C' type
09:09:48Araqtemplate mapValsIt*[A,B](t: Table[A,B], op: untyped): untyped =
09:09:48Araq mapVals(t, proc(v: B): auto = (let it{.inject.}=v; op))
09:10:15jaceredaoh, right! thanks!
09:10:52jaceredain any case, what about the other question? Is there any way to give `op` a type?
09:12:31*dom96_w joined #nim
09:15:15Araqwell no, it contains an 'it' the compiler cannot resolve
09:15:47*dom96_w quit (Changing host)
09:15:47*dom96_w joined #nim
09:16:19Araqbtw nice solution, but bad for performance, you use closures and a table materialization
09:20:04jaceredawell, I'm only evaluating the feasability of migrating a large python code base, so your bad performance is probably impressive performance when looking through that glass :)
09:30:35FromGitter<narimiran> jacereda: not necessarily
09:31:07FromGitter<narimiran> i know i had some lousy performance using nim's tables, comparing to python's dict
09:31:38FromGitter<narimiran> that's why i said to you yesterday: don't aim for 1:1 translation between python and nim
09:32:44FromGitter<alehander42> @jacereda in any case it's possible to have zero-overhead abstractions for table operations(and we already have several), it's just a question of what would be the best API for them
09:35:23FromGitter<alehander42> so if you decide to migrate you'll have choice between different solutions for this particular aspect. Are there any other typical python patterns that you wonder about?
09:38:41jaceredaat this point not really, the code doesn't use many fancy python features... but you have been there before, can you foresee problems?
09:38:42Araqjacereda, for Python migration TableRef will suit you much better than Table
09:40:50jaceredaright, I'll use that
09:41:23*Sentreen joined #nim
09:42:56FromGitter<alehander42> @jacereda often people are trying to simulate python context managers, this is kinda easy with templates
09:43:39FromGitter<alehander42> the other thing is OOP: you can do OOP in Nim, but it's not the "dominant" paradigm
09:44:15jaceredano objects at all in that codebase
09:45:22FromGitter<alehander42> also sometimes very dynamic portions of code can be a bit tricky to port literally, so one needs to just think of a more Nim-ish alternative for them
09:46:43FromGitter<alehander42> you can get more experience from the nimbus guys, they've ported many python ethereum libs to nim
09:46:49jaceredaI'm disassembling the code produced for test.nim and it includes prologue/epilogue when it could be just imulq/retq... is that due to the c flags used?
09:47:22Araqwe do overflow detection in debug builds and other terrible stuff
09:47:30jacereda(I'm talking about the _colonanonymous_ instances)
09:47:54jaceredaI'm building in release mode
09:47:54Araqalways use -d:release or the upcoming -d:safe
09:48:09Araqoh that's your closure then
09:48:22jaceredayes
09:48:52jaceredabut I mean the frame pointer stuff isn't necessary, I guess it's due to the flags passed to the compiler
09:49:06jaceredahow can I specify additional flags?
09:49:11jaceredato clang?
09:50:32Araqnot sure but if you're into it, try to enable profile guided optimizations :-)
09:50:53AraqI never did, shows how much I really care about performance, I guess
09:53:02Araqbtw I'd like to have some "naive" Nim code with lines(), split stings and tables, somebody got some code handy for that?
09:53:42Araqsomething I'll turn into a Nim benchmark we try to make faster with every release :P
09:55:13FromGitter<alehander42> something calculating the frequency of "words" in a text file might be a good example
09:56:19Araqyeah, so lines + split + CountTable
09:56:46Araqwell I can write that on my own easily enough
09:57:40jaceredaAraq: using --passC=-fomit-frame-pointer makes the closure 2 instructions vs 5
10:03:34jaceredaI normally use 3 opt levels (debug/optimized/release), optimized keeps the frame pointer to help when using gdb/lldb, release uses something like -Ofast
10:05:03Araqwith PGO it should inline through the function pointer indirection
10:06:30jaceredaAraq: but PGO is very difficult to use for us, it's an interactive app with lots of code paths
10:14:34Araqalright
10:24:31*kapil____ quit (Quit: Connection closed for inactivity)
10:40:36FromGitter<kaushalmodi> Araq: That dumpLisp PR is now good to merge; passes everything.
10:42:41FromGitter<kaushalmodi> All: @PMunch did an awesome job making the parsetoml library pass all the tests in the toml-test test suite (it's a language agnostic TOML decoder validator). In the process, parsetoml added support for more TOML syntax. If you haven't yet used TOML config files for your projects, use it. It's beautiful :)
10:50:08*Snircle joined #nim
11:04:19FromGitter<narimiran> @kaushalmodi link to @PMunch's lib?
11:13:08FromGitter<kaushalmodi> It's a nimble package: parsetoml. Here's the link: https://github.com/NimParsers/parsetoml
11:17:45FromGitter<arnetheduck> @Araq, what's `-d:safe`?
11:19:43Araqa sane configuration, optimizations but plus important runtime checks
11:19:59FromGitter<arnetheduck> re overflow checks, with the right code gen, they're actually quite cheap.. ie in `nlvm` it uses the carry flag of operations - that put together with hinting and potentially coalescing multiple integer ops, would mean that it's "practically" free
11:20:30Araqcool :-)
11:21:20FromGitter<arnetheduck> ah nice. looking forward to that. can we go with `-O2`? `-O3` is often broken in gcc, like in 8.x where it causes a runtime explosion for the m&s gc for whatever reason
11:21:37Araqyeah, consider it done
11:21:57Araqthough I will switch to clang on windows, produces better code
11:22:04Araqand works without setting a PATH
11:22:51FromGitter<arnetheduck> latter sounds like the winning reason.. clang vs gcc depends a lot on the code, no clear winners there, from what I've seen when pushing both (in a previous job)
11:23:50FromGitter<arnetheduck> wdyt of making -d:safe not throw on overflow, but abort instead?
11:24:41FromGitter<narimiran> @kaushalmodi re: "If you haven't yet used TOML config files for your projects, use it. It's beautiful": i haven't, and i've just checked it. it looks quite nice. now i need to find where to use it :)
11:25:03FromGitter<arnetheduck> @narimiran +1 for toml ;)
11:31:37FromDiscord_<Sabena Sema> @araq: I need --genDeps to work while compiling (and in makefile format like gcc -MM), with absolute paths. Looks like gendeps is used for generating boot files? Should I just add a parameter for gendeps or should there be a new option
11:31:51*jacereda quit (Ping timeout: 252 seconds)
11:35:02FromGitter<kaushalmodi> @narimiran Any time you want to make anything runtime configurable for the user, think of TOML. :)
11:35:23FromGitter<narimiran> so, what did we say, is there way to make *everything* in some file exported/visible? (or should i put asterisks everywhere and there's nothing else i can do)
11:37:39*smt joined #nim
11:40:46AraqSabena Sema: nim produces $project.json in nimcache with the produced C(++) codefiles and whether they only need to be linked or recompiled
11:41:45Araqseems to be better for your task than --genDeps
11:42:53*cavariux quit (Ping timeout: 246 seconds)
11:43:25*cavariux joined #nim
11:48:16*vlad1777d_ joined #nim
12:02:26*poopBot joined #nim
12:03:06poopBotPMunch, does each gtk window run in seperate thread or not
12:04:51poopBoti want to shoot updates in other threads so it dosent block UI wile it downloads info from web
12:05:42poopBotplan was to spawn 1 new window ontop to show progress of update, tought duno if that can work from seperate thread
12:25:16*Vladar quit (Remote host closed the connection)
12:26:07*Vladar joined #nim
12:33:25dom96_wif you use async you won't need threads
12:34:11PMunchkaushalmodi, thanks for the kind words :)
12:34:25PMunchpoopBot, no all Gtk Windows by the same program run in the same thread
12:34:33*vlad1777d_ quit (Ping timeout: 252 seconds)
12:35:14PMunchThe way to have a long running task is to spin that up in a separate thread, and then use something like GLib.idle_add to add an event to the event queue of the main thread
12:36:49poopBotdom96_w, but async uses wait for and i dont want to wait anything, and i will just shoot in background thread go fetch for each episodede img disc ect , then stroe in sqlite , so dont think i need async for this
12:37:15dom96_wasync is concurrency
12:37:18dom96_wthreads is parallelism
12:37:22dom96_wyou don't need parallelism for this
12:37:37dom96_wusing async will be much easier for you too
12:37:49poopBotPMunch, thats the plan, just am trying to figure out how to desplay progress of other thread on gui
12:38:33poopBothmm how so, writing spawn FetchAllData() does all for me
12:38:40dom96_wJust use idle_add (or one of the timeout_add functions) and call asyncdispatch.poll in them
12:38:58dom96_wYou can then just run async procs with `asyncCheck myAsyncProc`
12:39:46poopBotoh thats nice , i was wtf why they make it like i have to waitFor aysic function
12:42:29poopBotonly benefint from async is i can easyer desply progress
12:42:45poopBotfrom what i understund
12:43:47poopBoti read little Nim in Action yesterday :)
12:49:10FromDiscord_<Sabena Sema> @araq, no I need gendeps, the project.json does not list the nim files that were used to generate the C files / output executable. Also it only lists the set of C files for an incremental build, not all of them. I don't want to compile the C myself anyway, I want to invoke the nim compiler, but I want to be able to propagate the dependency information (which nim files should trigger a rebuild) to ninja. Currently I'm doing this with a
12:50:42FromDiscord_<Sabena Sema> @poopBot: You probably want something like https://developer.gnome.org/gtk3/stable/gtk3-General.html#gtk-events-pending
12:52:43dom96_wpoopBot: All `waitFor` does is call `asyncdispatch.poll` until the future returned by the async procedure finishes
12:54:00PMunchpoopBot: http://ix.io/1q4C/
12:54:04PMunchIf you want to use threads
12:54:15FromGitter<nothratal> Wow, here is quite a lot going on! Hello together!
12:54:55PMunchThat's how you can send an event to the main threads event loop to access Gtk widgets safely
12:55:57PMunchNote that I use a channel instead of passing the pointer to idleAdd, this is because after the last round in the loop the mockWork thread might stop and release the memory of any internal data which would cause it to fail
12:56:33dom96_wyeah, trust me, threads + channels + unsafe GTK is not fun
12:58:24shashlickAnyone interested in a libgraphqlparser wrapper - need some expertise to validate that it does what it is supposed to - please get in touch
12:58:41*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
13:00:26AraqSabena Sema: It does list all of them in the linking command
13:00:44FromDiscord_<Sabena Sema> that's all the C object files though right?
13:00:59Araqwell yes
13:01:14Araqthis has come up before so please enlighten me
13:01:18FromDiscord_<Sabena Sema> so if I use include .....
13:01:27Araqhow does Nim work with e.g. Ninja?
13:01:44dom96_wshashlick: a pure Nim parser would be awesome, we could use it at compile-time then
13:01:46FromDiscord_<Sabena Sema> not well....
13:01:47FromDiscord_<Sabena Sema> https://gist.github.com/barcharcraz/9ec04ca3a3a0f6f20df44659878d3ad5
13:01:53Araqcurrently if a single Nim file changes in your project you need to rerun 'nim c myproject'
13:02:16Araqyou don't run 'nim c someNimFile', Nim doesn't work this way
13:02:22FromDiscord_<Sabena Sema> no I know
13:02:39FromDiscord_<Sabena Sema> let me link to an example build def
13:03:09*stefanos82 quit (Quit: Quitting for now...)
13:03:29FromDiscord_<Sabena Sema> https://github.com/barcharcraz/meson/blob/nim-support/test%20cases/nim/1%20basic/meson.build
13:04:06FromDiscord_<Sabena Sema> that's a single file, but the idea is you'd never specify more than one nim file in the executable() statement (except maybe if you're trying to use rod files, but those don't work so it's a moot point)
13:06:30FromDiscord_<Sabena Sema> rust works similarly, however the test cases don't demonstrate it very well
13:08:00*Snircle joined #nim
13:09:06poopBotPMunch, hmm i can bend this to my will , but firsty will go read little abut Channels and Gpointer
13:10:17poopBotoh so Gpointer and Gboalen come from gtk thats why this {.cdec1.}
13:10:22AraqSabena: ok, what's the feature request again? "Make --gendepend work"?
13:10:58shashlick@dom96: that would be cool but beyond what I can do
13:11:07FromDiscord_<Sabena Sema> Umm gendeps. I can submit a PR. Give me a moment to type up the current situation.
13:11:30PMunchpoopBot, yeah those are just Glib types
13:11:41FromDiscord_<Sabena Sema> Gpointer is just a void*
13:11:43PMunchBut as you see I don't really use them for anything in my example
13:11:54FromGitter<mratsim> @dom96 I was quite interested in tree-sitter for parsing: https://github.com/tree-sitter/tree-sitter
13:12:44FromGitter<mratsim> In a talk they presented that as an alternative to language server that can be embedded as it’s pure C
13:13:47FromDiscord_<Sabena Sema> oh, for LSP you may want to check out what gnome-builder does. It does some neat tricks
13:15:03FromGitter<mratsim> oh yeah that was this talk: https://www.youtube.com/watch?v=Jes3bD6P0To
13:15:32FromGitter<mratsim> I guess we can just c2nim it and we have a parser in pure Nim :D
13:21:56FromDiscord_<Sabena Sema> OK so the current gendeps status:
13:21:56FromDiscord_<Sabena Sema>
13:21:56FromDiscord_<Sabena Sema> 1) --genDeps implies --compileOnly
13:21:57FromDiscord_<Sabena Sema> 2) --genDeps implies --genScript
13:21:57FromDiscord_<Sabena Sema> 3) --genScript causes extccomp.noAbsolutePaths to return True
13:21:59FromDiscord_<Sabena Sema> 4) noAbsolutePaths means that the generated command lines are different and makes compilation fail even if (1) is fixed.
13:21:59FromDiscord_<Sabena Sema> 5) Fixing 1-4 changes how --genScript and --genDeps work, potentially breaking the generation of csources for booting
13:22:01FromDiscord_<Sabena Sema>
13:22:02FromDiscord_<Sabena Sema> Additionally:
13:22:06FromDiscord_<Sabena Sema> 1) --genDeps outputs to a file that's one dependency per line, now I don't mind this but it's not how other languages do it (they imitate -MM and output a makefile snippet). Ninja actually doesn't strictly require a makefile snippet, you just have to be kinda close.
13:22:08FromDiscord_<Sabena Sema> 2) Ninja reads dependency files directly after invoking the compiler and caches the results
13:22:11FromDiscord_<Sabena Sema> 3) adding nim format support into ninja isn't hard, however actually getting it merged is, because ninja isn't really maintained very well.
13:22:12FromDiscord_<Sabena Sema>
13:22:16FromDiscord_<Sabena Sema> My core question is whether I can just fix genDeps and make it do what I want, maybe adding an option for no absolute paths, or if there should be a new option, or perhaps allow something like --gendeps:makefile or --gendeps:gcc
13:26:18*endragor quit (Remote host closed the connection)
13:29:15Araq--gendeps isn't used by niminst at all
13:29:47Araqand genscript is something else I think
13:30:19Araq--gendeps is used to produce these nice GraphViz based graphs
13:30:37Araqiirc
13:32:14AraqI dunno, go for --gendeps:gcc, I'm allergic to makefiles
13:34:58dom96_wmratsim, shashlick: #ParseUtils4Life
13:35:17dom96_wMy book has a good chapter on parsing ;)
13:35:47FromGitter<mratsim> I dread when I have to implement a parser for natural language processing ...
13:36:11FromGitter<mratsim> especially when supporting emojis and non-ASCII characters
13:40:27FromDiscord_<Sabena Sema> I think genDepend is for graphviz
13:40:43FromDiscord_<Sabena Sema> --genDeps produces a .deps file
13:42:49Araqor maybe patch Nim so that $project.json also includes the nim files
13:43:20AraqI'm not a fan of adding more and more output formats to the compiler
13:43:39Araqbetter produce json and have some external tools to translate it further
13:46:35*endragor joined #nim
13:49:09FromDiscord_<Sabena Sema> hmm yeah, that still needs a compiler wrapper in meson though, since ninja doesn't support doing any kind of postprocessing.
13:49:28FromDiscord_<Sabena Sema> it's a good solution though, and I'm all for not letting any make into nim
13:50:08FromDiscord_<Sabena Sema> ninja is going to be forked eventually anyways unless the maintainership situation gets better
13:51:20*endragor quit (Ping timeout: 272 seconds)
13:53:16FromDiscord_<Sabena Sema> yeah that's ideal. The compiler wrapper can use the msvc /showIncludes syntax as well, which should avoid make even more
13:59:27*revere quit (Ping timeout: 264 seconds)
14:00:02*revere joined #nim
14:08:00*onionhammer quit (Read error: Connection reset by peer)
14:08:50*kapil____ joined #nim
14:09:06*onionhammer joined #nim
14:11:01UNIcodeXquestion. how to generate a range of numbers with a step. there appears to be no way to specify a step using {n .. n}
14:11:03*revere quit (Ping timeout: 250 seconds)
14:11:23*revere joined #nim
14:12:43UNIcodeXI see countup() and countdown(), but when trying to call them I get "Error: attempting to call undeclared routine"
14:13:07*onionhammer1 joined #nim
14:14:29*narimiran joined #nim
14:15:08*onionhammer quit (Ping timeout: 246 seconds)
14:16:05poopBotPMunch, i think i got evrything exepct idleAdd, i got what you talked about memory and fail(or i think :)) but dont know from where idleAdd comes from, it that form gtk somwere?
14:17:50FromGitter<mratsim> @UnicodeX, countup and countdown are iterators, you can only use them in a for loop
14:18:13FromGitter<mratsim> for i in countup(0, 10, 2)
14:18:25UNIcodeXwould this not work -- "for i in countup(0, 500, 3): echo(i)"
14:18:35FromGitter<mratsim> yes it would
14:18:38UNIcodeXit's not
14:18:47FromGitter<mratsim> !eval for i in countup(0, 500, 3): echo(i)
14:18:51NimBot0↵3↵6↵9↵12↵15↵18↵21↵24↵27↵30↵33↵36↵39↵42↵45↵48↵51↵54↵57↵60↵63↵66↵69↵72↵75↵78↵81↵84↵87↵90↵93↵96↵99↵102↵105↵108↵111↵114↵117↵120↵123↵126↵129↵132↵135↵138↵141↵144↵147↵150↵153↵156↵159↵162↵165↵168↵171↵174↵177↵180↵183↵186↵189↵192↵195↵198↵201↵204↵207↵210↵213↵216↵219↵222↵225↵228↵231↵234↵237↵240↵243...
14:18:59FromGitter<mratsim> ^ works
14:19:19UNIcodeXhttps://hastebin.com/xapehikomo.bash
14:19:37UNIcodeXerror - https://hastebin.com/zobacunugi.apache
14:19:56FromGitter<mratsim> it works here: https://play.nim-lang.org/
14:20:18narimiranworks at my end
14:20:24UNIcodeX@mratsim, I installed Nim 0.19 from the main website yesterday
14:20:29UNIcodeXnot sure why it wouldn't be working
14:20:54dom96_wdid you name your file `countup.nim`?
14:20:55PMunchpoopBot, idleAdd comes from Glib. Gtk uses the Glib event system for it's events, idleAdd adds an event to t he queue of events to process
14:21:02UNIcodeXdom96_w, negative. :)
14:21:40dom96_wweird
14:22:11narimiranworks both in 0.19 and devel
14:22:33*krux02_ joined #nim
14:23:06UNIcodeXI'm trying it on windows. https://hastebin.com/yivojunelo.css
14:23:14*krux02 quit (Read error: Connection reset by peer)
14:24:18UNIcodeXI mean to say, that's where I'm getting the error.
14:24:18FromGitter<kaushalmodi> UNIcodeX: as an aside, if you use ptpb.pw instead of hastebin, you can get Nim syntax highlighting by appending "/nim" to the generated paste URL
14:24:52dom96_wSomething must be wrong with your installation
14:25:04dom96_wor you've added some invisible characters into your file by accident
14:25:21UNIcodeXfresh file. all typed by hand. no pasting
14:25:23dom96_wTry compiling hello world and other simple scripts
14:25:31UNIcodeXI have. they work fine
14:25:40narimirantry `countdown`
14:25:55UNIcodeXThis is the only thing that's given me an error that you confirm as a "shouldn't happen"
14:25:58UNIcodeXok
14:26:12dom96_walso try `1 .. 5`
14:26:16dom96_wthat's an alias for countup
14:26:19UNIcodeXcountdown works fine... wtf
14:26:27UNIcodeXbut what about the step
14:26:28*revere quit (Ping timeout: 246 seconds)
14:26:36poopBotPMunch, ty :)
14:26:58*revere joined #nim
14:27:15narimiranUNIcodeX: try everything: `1 .. 5`, then `countup(1, 5)`, then `countup(1, 10, 2)`
14:27:51FromGitter<mratsim> There’s is a shroedinger cat inside your computer
14:28:25dom96_wAre you perhaps within the vicinity of a nuclear reactor?
14:29:30UNIcodeXnarimiran, `1 .. 5` (without backticks) works, countup(1, 5) worked, then countup(1, 10, 2) worked. I CTRL-Z'd back to the code I pasted and you confirmed as evaluating above, and it worked this time.
14:29:44*UNIcodeX throws up hands....
14:30:00narimiranit works every other time. try it again and it won't work :P :D
14:30:07FromGitter<kaushalmodi> UNIcodeX: So what doesn't work? What's the error you are getting?
14:30:28FromGitter<kaushalmodi> May be you ended up with a weird mix of some old and new Nim stdlibs?
14:30:49UNIcodeXI don't know why it gave me the error. It's working fine now. I swear I ran it like 20 times and got the error. after i tried 1 .. 5 and countdown(), countup() started working....
14:31:20krux02_for me personally I have very good experience to not use anything but the `..<` iterator
14:31:37UNIcodeXwhat's the < part do?
14:31:47krux02_no inclusive upper bound
14:31:52krux02_0 ..< 10
14:31:53narimiranUNIcodeX: "until to, not including"
14:32:01krux02_0, 1, 2, ... , 9
14:32:02UNIcodeXoh. so 1 .. 10 < would be 1 - 9
14:32:05UNIcodeXk
14:32:22UNIcodeXerr... 0 - 9
14:32:36UNIcodeXNM... i had it right
14:32:38krux02_not really
14:32:49krux02_1 .. 10 is 1 .. 10
14:32:58krux02_1 .. 10 < is invalid
14:33:03UNIcodeXI'm still new to Nim.
14:33:08UNIcodeXobviously
14:33:18krux02_..< is a signle token
14:33:25krux02_it's the name of the iterator
14:33:32UNIcodeXgotcha
14:33:35krux02_it is implemented as an operator
14:33:44krux02_in the past there was an unary <
14:33:58krux02_but that got removed
14:34:25FromGitter<kaushalmodi> UNIcodeX: don't worry, looks like many people stumble across that (I did :P): https://scripter.co/notes/nim/#space-around-dot-dot
14:36:39UNIcodeX@kaushalmodi, nice resource. thanks
14:44:57*PMunch quit (Quit: Leaving)
14:47:03*rockcavera joined #nim
14:48:01*poopBot quit (Remote host closed the connection)
14:50:22*xet7 quit (Read error: Connection reset by peer)
14:53:16UNIcodeXI'm getting an error about indentation now. I'm using VSCode to edit this file. https://gist.github.com/UNIcodeX/07283d417e2107dbe466eab9d6d7b8a1
14:54:39*Calinou quit (Ping timeout: 264 seconds)
15:04:27AraqUNIcodeX, (n: int): int
15:04:33Araqyou missed a colon
15:04:49UNIcodeXah shit. lol
15:04:50UNIcodeXthanks
15:07:22UNIcodeXAraq, trying to change it to return a sequence. says got seq[int] but expected seq[int]. lol. looks like it got what it was expecting to me. :shrugs:
15:08:54UNIcodeXnevermind. since result is a special varable within the proc, turns out I was unnecessarily instantiating it as seq[int]. the return type takes care of that for me it seems. I was repeating myself in essence.
15:09:23UNIcodeXI'm getting the hang of it. Nim is different than Python, but not too different. It's been exciting thus far.
15:09:35narimiranUNIcodeX: this might be useful to you: https://narimiran.github.io/nim-basics/ (disclaimer: i'm the author)
15:09:53UNIcodeXnarimiran, thank you!
15:10:21UNIcodeXI've done tons of programming in Python, but I'm trying to broaden my horizen.
15:11:09UNIcodeXI've evaluated Go, Rust, and Nim. I do plan to dabble in the other two as well, but I'm trying to focus on one at a time so as to minimize confusion between language syntax, etc...
15:11:21narimiranUNIcodeX: nim at first seems like python's cousin (because of significant whitespace and similar syntax), both the more you learn nim, the more you'll see differences and the power of nim
15:11:36narimiran*both = but
15:12:02UNIcodeXI see power and potential already. Nim compiles to multiple other languages. That right there is very powerful.
15:12:07UNIcodeXI know what you mean though
15:12:22UNIcodeXthe kind of epiphany that only usage can afford
15:13:09narimirani come from python, and i had multiple "why is this not the same way like in python", because i falsely thought the two languages are more similar than they really are
15:13:23UNIcodeXI bet
15:14:19narimirani hope that "Nim Basics" will be enough to get you on your feet with nim. your feedback would be welcome
15:14:33*Vladar quit (Remote host closed the connection)
15:15:28UNIcodeXI am interested in cross-platform coding. Nim seems like it would handle that with relative ease. I saw a couple of blog articles about building Android apps. Of course it requires the Android SDK / NDK, and I don't know what GUI toolkit / library I'd have to use, so input on that would be welcome. The other alternative is Kivy, which looks pretty, but will be much less performant than native code.
15:15:37Araqto be fair though, a lot of times we took a feature from Python and re-thought it for how it would fit a systems programming language
15:15:39UNIcodeXnarimiran, for sure. I'll go through it and let you know what I think.
15:16:42UNIcodeXI've also done some stuff in micropython on ESP chips. That's pretty cool capability. Is there anything for microcontrollers and Nim?
15:17:18UNIcodeXI know I'm kind of in multiple directions at the moment, but it's got me excited. :)
15:17:24narimirani think there is something called "ardunimo", but i don't know anything about it
15:19:05narimiranre: multiple directions: start slow :) get to know nim first ;)
15:19:51UNIcodeX:)
15:20:07UNIcodeXindeed.
15:35:41FromGitter<zacharycarter> UNIcodeX - not to throw a wrench in your plans or anyhting
15:35:54FromGitter<zacharycarter> but android native development - whether you're using Nim or Rust or C/C++ - sucks
15:36:17FromGitter<zacharycarter> because the android team seems to care very little about native development
15:36:44FromGitter<zacharycarter> as far as x-platform GUI - I believe there are a few options there but none that are that great
15:36:58FromGitter<zacharycarter> nothing like Qt
15:37:14FromGitter<zacharycarter> webview or CEF might be an optoin
15:37:18FromGitter<zacharycarter> there's always electron too
15:37:31UNIcodeX@zacharycarter, what's good to use then? I have no idea where to start.
15:37:41UNIcodeXoh. i see.
15:37:45UNIcodeXyou answered already
15:37:52UNIcodeXmultiple chat windows open.
15:38:04FromGitter<zacharycarter> :P np - it depends a lot on what you want to build tbh
15:38:22FromGitter<zacharycarter> you might start with this search - https://nimble.directory/search?query=gui
15:38:46UNIcodeXand there's the other part of it. Lots of things I've thought to build for mobile, already exists.
15:39:34FromGitter<zacharycarter> btw - here's that ardunimo project narimiran mentioned - https://github.com/gokr/ardunimo
15:39:46FromGitter<zacharycarter> if you just want to get started with Nim - and at the same time build something fun
15:39:59FromGitter<zacharycarter> hmmm let me think for a tick - and I'll try to come up with an idea
15:41:33dom96_wPlenty of project ideas here https://github.com/nim-lang/needed-libraries/issues
15:41:39dom96_wAlso https://forum.nim-lang.org/t/1672
15:41:47FromGitter<zacharycarter> well - I think he's looking for something rather specific
15:41:48UNIcodeXdom96_w, cool
15:42:08FromGitter<zacharycarter> something related to mobile dev, that's beginner level and will also involve some x-compilation
15:42:22FromGitter<zacharycarter> but those are good suggestions as well - maybe there's an idea on there that fits the bill already
15:46:54FromGitter<yyyc514> InstantiationInfo
15:46:58FromGitter<yyyc514> isn’t instantion info in system?
15:47:04FromGitter<yyyc514> Error: undeclared identifier: 'InstantiationInfo'
15:53:59*Trustable joined #nim
15:54:30*darithorn joined #nim
15:55:39FromGitter<yyyc514> is `private` a reserved word?
15:58:28FromGitter<yyyc514> ah i figured it out… my string iterpolation is breaking in the template because i’m not working with real variables, hmmm
15:59:11*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
15:59:52*enthus1ast joined #nim
16:01:57enthus1astim wondering if `spawn(getMD5(req.body))` getMD5 runs in the thread or if i must wrap `getMD5(req.body)` in a proc
16:02:20enthus1astbecause it *seems* to block the main thread
16:02:27*Lord_Nightmare joined #nim
16:09:09enthus1astoh man it seems it does, then its something else, i should have become an gardener or so
16:12:37*nsf quit (Quit: WeeChat 2.2)
16:13:09*federico3_ is now known as federico3
16:13:36*krux02_ quit (Remote host closed the connection)
16:26:36FromGitter<Mobilpadde> Hey! Got a question. Is there a way to use strings as indices in sequences?
16:26:58shashlickyou want a table
16:27:16FromGitter<Mobilpadde> Oh, thanks! :D
16:27:19FromGitter<Mobilpadde> Saved my day!
16:35:05FromGitter<alehander42> ok
16:41:30narimiran@Mobilpadde if char (instead of string) would work for you: you can use arrays with char indices
16:41:37FromGitter<kaushalmodi> Critbits work great if you want strings as indices
16:41:49narimirane.g. `var foo: array['a'..'c', int]`
16:47:45FromGitter<zacharycarter> https://github.com/filcuc/nimqml - https://www.vandenoever.info/blog/2017/02/17/a-simple-rust-gui-with-qml.html - wonder if we could write a similar post for Nim
16:47:54FromGitter<zacharycarter> I haven't played w/ Nim's QML bindings yet
16:53:38*dom96_w quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:58:19xaceI'm trying to store a proc in a variable to use it later, can someone help me figure it out? https://pastebin.com/raw/gEZMVQvb
17:00:48narimiranxace: `var cbp: proc(s: string)`
17:01:43shashlickhttps://github.com/genotrance/nimgraphql
17:01:46xacenarimiran: is the `var` required?
17:02:03*PrimHelios_ joined #nim
17:02:22narimiranwell, you need to declare it, so: yes, it is required
17:02:44FromGitter<zacharycarter> so many people have wrapped that library already :P myself included
17:02:57FromGitter<zacharycarter> I'm guessing you did it with nimgen though shashlick?
17:03:09FromGitter<zacharycarter> now we just need a gql server impl :P
17:03:14xacenarimiran: is the `(s: string)` parameter name important there or can I just state there is a string there?
17:03:44shashlick@zacharycarter: well, I had tried some months ago but nimgen wasn't good enough back then
17:03:49shashlickdidn't realize it was done already
17:04:07narimiranxace: you can have `anything: string`
17:04:20shashlickI found https://github.com/samdmarshall/GraphQL.nim but it wasn't functional
17:05:02FromGitter<zacharycarter> meh - probably better to have them produced with nimgen - more maintainable I'm thinking
17:05:05xacenarimiran: oki, thank you :)
17:05:24shashlick@zacharycarter: please check it out if you get a chance
17:05:32FromGitter<zacharycarter> well - the parser is mostly useless until we get a gql server impl I think
17:05:41FromGitter<zacharycarter> okay - I should have some time later this afternoon / evening
17:10:53*enthus1ast quit (Ping timeout: 276 seconds)
17:23:53*PrimHelios_ quit (Ping timeout: 252 seconds)
17:28:59FromGitter<iffy> How do I pass additional flags to `nimble build` and `nimble install`? I've read the Nimble readme, but I guess I'm missing it
17:30:31FromGitter<iffy> Rather, I want to put something in my `.nimble` file so that when I run `nimble build` in includes my additional flags
17:30:43*enthus1ast joined #nim
17:31:07shashlickuse a nim.cfg
17:31:14shashlickor use pragmas
17:31:41FromGitter<iffy> I thought I'd used a pragma for that before. Which one is it?
17:31:51FromGitter<iffy> to pass a -d:something
17:32:28narimiran`define:"something"` in nim.cfg
17:33:40shashlicki don't think there's a define pragma, it was deprecated, though I am hoping Araq brings it back
17:34:04FromGitter<iffy> oh, okay; the `nim.cfg` option works for now; thank you!
17:38:06*PrimHelios_ joined #nim
17:52:13*rockcavera quit (Remote host closed the connection)
17:52:56*rockcavera joined #nim
17:54:03*rockcavera quit (Remote host closed the connection)
17:54:26*rockcavera joined #nim
17:58:51*enthus1ast quit (Ping timeout: 264 seconds)
17:59:15*enthus1ast joined #nim
18:06:14*Perkol joined #nim
18:11:25Summertime2ok so I have bin = @["bin/some_such"], which the result wants to be placed in ./bin/some_such, the bin folder doesn't exist so this is an error, I can't use a `before build` because it won't apply before install
18:12:30Summertime2I tried `mkDir binDir / "bin"` with binDir should be the root of the project by default with before install but that causes an error
18:14:55*elrood joined #nim
18:17:31Summertime2oh right, this is with a srcDir defined as src
18:18:03*enthus1ast quit (Ping timeout: 264 seconds)
18:18:17FromGitter<iffy> @zacharycarter on that QML stuff, I'm always confused by Qt's license. Would I have to follow Qt's LGPL/GPL/Commercial license if I made an app using that nimqml library?
18:18:47FromGitter<recloser> does anyone know how long the `--nilseqs:on` transition period is supposed to be? is it going to get removed in v0.20?
18:20:36*wildlander joined #nim
18:27:36Summertime2https://travis-ci.org/Summertime/splatter-kit/jobs/446826109#L523 @ https://github.com/Summertime/splatter-kit/tree/7db918f for my issue
18:35:20*jjido joined #nim
18:36:31shashlickSummertime2: you could create an empty 'bin' directory
18:37:56Summertime2would be a bit more trouble than worth, since git doesn't like blank directories (I could put in a blank file and then add an exception to my gitignore I guess)
18:38:37copygirlAnyone know why `proc test*[T](foo: T; other: typedesc): other = {.fatal: $other.}` doesn't work ("cannot evaluate at compile time: other"), while if I remove `[T]` and make `foo` an integer, it does?
18:38:52Summertime2what am I complaining about I guess, it'll work well enough ay, thanks for the guidance
18:39:08copygirl(I can also fix it by using a template instead of a proc.)
18:39:31shashlickSummertime2: i've seen some repos with an empty.txt
18:40:39narimiranshashlick: nim repo is one of them ;)
18:41:29Summertime2oof
18:46:02*PrimHelios_ quit (Ping timeout: 246 seconds)
19:04:15*jjido quit (Ping timeout: 264 seconds)
19:05:34*dddddd joined #nim
19:10:08Araqrecloser: 0.20 will still have it
19:13:04FromGitter<iffy> Is the warning on getTempDir still valid? https://nim-lang.org/docs/ospaths.html#getTempDir%2C It seems like https://github.com/nim-lang/Nim/issues/5260 fixed it, no?
19:17:44FromGitter<recloser> @Araq: that's too bad, a bunch of bugs i found in jsgen would be easier to fix if it could be assumed that the strings/seqs are never null
19:17:54*nsf joined #nim
19:18:09AraqI think you misunderstand this switch
19:18:31Araqstrings/seqs of length 0 is mapped to JS's null and that's unlikely to change
19:19:17*zachk joined #nim
19:19:21FromGitter<recloser> it would be easier if they were initialized as normal objects, otherwise a ton of temporaries have to be made because of dereferencing
19:20:11*zachk quit (Changing host)
19:20:11*zachk joined #nim
19:20:22FromGitter<recloser> like you could just push something to a seq with just "$1.push($2)"
19:21:00copygirlSo here's my `Either` types: https://gist.github.com/copygirl/60d5446bdcfe305d70a2c17a8c199790
19:21:02FromGitter<recloser> right now there's a ton of bugs in jsgen because temps aren't properly generated and the code evaluates exprs multiple times
19:21:28copygirlAraq, you seemed to be confused by my goal for them, so.. not sure, maybe you'd be interested in taking a quick look at it?
19:21:54FromGitter<recloser> like from impl of mAppendSeqElem: `r.res = "if ($1 != null) { $1.push($2); } else { $1 = [$2]; }" % [x.rdLoc, y.rdLoc]`
19:22:02FromGitter<recloser> double evaling `$1`
19:27:24FromGitter<kaushalmodi> Has anyone tried to read an env var in Nim code that compiles to JS?
19:27:27copygirlOh and someone suggested `node.strVal` instead of `$node.ident` but that didn't seem to work in my case.
19:28:12FromGitter<kaushalmodi> About getting env var in JS, this works `greeting = $(process.env.GREETING.to(cstring))`, but I cannot check if that var exists or not
19:28:29FromGitter<kaushalmodi> I was hoping `getEnv` would Just Work (TM) for JS export too
19:28:31FromGitter<kaushalmodi> :)
19:29:09*PrimHelios_ joined #nim
19:33:36FromGitter<alehander42> which var exists or not?
19:34:10FromGitter<kaushalmodi> I am continuing my exercise from yest
19:34:25FromGitter<alehander42> I use `proc isNone*T (a: T): bool {.importcpp: "(# == null)", noSideEffect, tags: [].}`
19:34:31FromGitter<alehander42> which matches undefined and null
19:34:35FromGitter<alehander42> but might not be the best name
19:35:33FromGitter<kaushalmodi> may be I can compare with https://nim-lang.org/docs/jsffi.html#jsNull ?
19:35:39FromGitter<kaushalmodi> or jsUndefined?
19:41:27*PrimHelios_ quit (Ping timeout: 264 seconds)
19:55:54FromGitter<kaushalmodi> @alehander42 got this to work: https://ptpb.pw/bkz3/nim
20:06:47*PrimHelios_ joined #nim
20:13:44*Jesin quit (Quit: Leaving)
20:19:48Araqrecloser: double evals can be dealt with by transforming f(a) into tmp = f(a); tmp
20:22:36*PrimHelios_ quit (Ping timeout: 252 seconds)
20:23:02FromGitter<recloser> i know, the thing is it's just doing that everywhere is pretty error prone
20:23:33FromGitter<recloser> also that doesn't really work for ptrs/refs right now
20:24:11FromGitter<kaushalmodi> What does `nodecl` pragma do? Example: `var console {. importc, nodecl .}: JsObject` from https://nim-lang.org/docs/jsffi.html
20:27:29*Perkol quit (Quit: Leaving)
20:32:15FromGitter<yyyc514> so can i pass an array instead of varargs?
20:32:40FromGitter<kaushalmodi> you mean pass to a proc?
20:34:48*nsf quit (Quit: WeeChat 2.2)
20:38:32FromGitter<alehander42> it tells it shouldn't generate a declaration according to an old tutorial
20:38:46FromGitter<alehander42> but I thought importc does this too, maybe its an old pragma
20:39:26FromGitter<kaushalmodi> oh.. I was reading "nodecl" as "node cl".. I was wondering what that meant
20:39:32FromGitter<kaushalmodi> so the docs need updating?
20:40:11FromGitter<alehander42> I wonder if `nodecl` is still useful, I can't understand what's the difference between `importc` and `nodecl` right now (Araq ?)
20:40:36FromGitter<alehander42> actually it is in the manual
20:40:38FromGitter<kaushalmodi> I just found it in manual too: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-nodecl-pragma
20:40:42FromGitter<kaushalmodi> yeah :)
20:41:09FromGitter<kaushalmodi> that still doesn't exactly explain me what it does
20:41:16Araqit's also kinda obvious, if you import from C you still want to generate some declaration for it, unless it is either .nodecl or .header
20:41:45FromGitter<alehander42> yeah, I've used importc in the JS backend most of the time
20:42:27FromGitter<kaushalmodi> I don't see different between imported vars with and without nodecl
20:42:50*Jesin joined #nim
20:43:09FromGitter<kaushalmodi> Example: https://ptpb.pw/Eyas/js ; `exports` var doesn't have nodecl, `console` has
20:47:33FromGitter<kaushalmodi> ?
20:47:47FromGitter<kaushalmodi> Araq: So nodecl doesn't do anything for JS export?
20:48:43*jsonfrost joined #nim
21:20:51*Calinou joined #nim
21:26:44*narimiran quit (Quit: Konversation terminated!)
21:29:23*Jesin quit (Quit: Leaving)
21:34:47FromGitter<zacharycarter> @iffy not 100% sure on that
21:35:31FromGitter<zacharycarter> interesting - I just recently used nodecl all over the place
21:35:33FromGitter<zacharycarter> in a JS project
21:36:05*Trustable quit (Remote host closed the connection)
21:36:56FromGitter<zacharycarter> shashlick: another library I wrapped a while ago - but I think would be a good one to use nimgen on is - https://github.com/jarikomppa/soloud
21:38:11FromGitter<kaushalmodi> @zacharycarter would you be up for few Nim->JS 101 Q's from me?
21:38:53FromGitter<kaushalmodi> ~~few~~ may be just 1
21:40:22FromGitter<zacharycarter> sure
21:40:28FromGitter<zacharycarter> at least I can try to answer them
21:41:02FromGitter<kaushalmodi> In JS, there is `import querystring from "querystring";`. What do I write in Nim that exports to that?
21:41:38FromGitter<kaushalmodi> it's a different issue to figure out if querystring is an internal node module or something I'll need to provide
21:42:27shashlick@zacharycarter: will check it out
21:43:31FromGitter<iffy> Can someone on Windows tell me if this fails for them? ⏎ ⏎ ```import os ⏎ doAssert normalizedPath("C:\\a\\b") == "C:\\a\\b"``` [https://gitter.im/nim-lang/Nim?at=5bd38a83ae7be94016bfc3e0]
21:44:02FromGitter<zacharycarter> @kaushalmodi - do you mean you want to import the querystring proc from the querystring module, and export it as something else?
21:44:12FromGitter<zacharycarter> not 100% understanding your question
21:44:30FromGitter<zacharycarter> or are you saying you want to export something as querystring?
21:44:32FromGitter<kaushalmodi> @zacharycarter I want to write Nim code that effectively exports to https://github.com/kaushalmodi/nim-netlify-functions/blob/master/src/lambda/to_be_converted/hello_name_post.js#L1
21:44:51FromGitter<zacharycarter> hmm
21:45:20FromGitter<kaushalmodi> e.g. https://github.com/kaushalmodi/nim-netlify-functions/blob/master/src/lambda/hello_env.nim translates to https://github.com/kaushalmodi/nim-netlify-functions/blob/master/src/lambda/orig_js_funcs/hello_env.js
21:46:04FromGitter<yyyc514> can i give a macro access to a routine if i declare is compileTime?
21:46:49FromGitter<zacharycarter> I see what you mean
21:47:07FromGitter<zacharycarter> import statements are tough
21:47:13FromGitter<zacharycarter> because they have to go at the top of the JS file if I'm not mistaken
21:47:27FromGitter<zacharycarter> this is why I've generally stuck with commonjs modules and used require instead of import
21:48:38FromGitter<zacharycarter> I've tried to do something similar by doing like - `proc importJS(importName: cstring, moduleName: cstring): JsObject {.importcpp: "import # from '#'".}`
21:48:57FromGitter<zacharycarter> but that doesn't work really - because it's unlikely that the statement will get hoisted to the top of the JS file
21:49:09FromGitter<zacharycarter> that's why I've commonly used required - does that make sense @kaushalmodi ?
21:49:23FromGitter<zacharycarter> I know there is SOMETHING somewhere in the stdlib to hoist nim expressions to the top of the source file
21:49:43FromGitter<zacharycarter> but, it says it should only be used for development / debugging purposes - not even sure how it'd help in that scenario
21:49:54shashlick@iffy: Error: unhandled exception: C:\Users\..\ctest.nim(3, 10) `normalizedPath("C:\\a\\b") == "C:\\a\\b"` [AssertionError]
21:49:56FromGitter<zacharycarter> should probably be some kind of issue / RFC for this and the JS backend
21:50:18FromGitter<iffy> thanks; I'll file a bug (and hopefully a fix)
21:50:54FromGitter<kaushalmodi> @zacharycarter I don't understand the "have to go to the top of the JS file"
21:50:59FromGitter<kaushalmodi> But I'll see what I can do
21:51:05shashlicknormalizedPath("C:\\a\\b") returns \C:\a\b
21:51:20FromGitter<kaushalmodi> I have https://ptpb.pw/GPLN/nim.. the only missing piece (I think ) is that import statement at the top
21:51:27FromGitter<iffy> shashlick: That's what I'm seeing, too but it shouldn't, right?
21:51:40shashlickI agree
21:52:51shashlickbroken on 0.19.0 and #head
21:52:56FromGitter<iffy> k, submitted a PR -- I don't have a handy windows machine (just AppVeyor where I noticed the bug)
21:52:58shashlickproc isn't there in 0.18.0
21:55:06FromGitter<zacharycarter> @kaushalmodi - https://medium.com/@jakewies/you-must-import-all-es6-modules-at-the-top-level-of-your-javascript-files-67888dfad66
21:56:27FromGitter<zacharycarter> not sure how you get around that restriction
21:59:01FromGitter<zacharycarter> http://exploringjs.com/es6/ch_modules.html#sec_basics-of-es6-modules - might further clarify
21:59:21FromGitter<zacharycarter> from my understanding the statements will be hoisted by your ES6 transpiler
21:59:29FromGitter<zacharycarter> so they need to be declared at a top level scope
21:59:31FromGitter<kaushalmodi> @zacharycarter OK, looks like I have a lot of reading to do
22:00:03FromGitter<kaushalmodi> your suggested snippet does create that import at top level: https://ptpb.pw/kYaG/js
22:00:06FromGitter<zacharycarter> those imports are a ES6 proposal - they are not actually available in most all browsers without having a pollyfil
22:00:07FromGitter<kaushalmodi> but not at top of the file
22:00:17FromGitter<zacharycarter> or having some type of transpiler like babel
22:00:55FromGitter<kaushalmodi> As I don't know JS at all, it's a huge info overload
22:01:04FromGitter<zacharycarter> https://auth0.com/blog/javascript-module-systems-showdown/ - probably a good article to view
22:01:38FromGitter<kaushalmodi> may be that code works (the last link I pasted), but now I need to figure out where the querystring module is coming from
22:02:12FromGitter<kaushalmodi> here is the original source: https://github.com/netlify/netlify-functions-example
22:02:31FromGitter<kaushalmodi> querystring is probably coming from one of those packages in packages.json
22:03:36FromGitter<kaushalmodi> I just want to make that small script run, and as I am not familiar with yarn, package.json, I am slowly trying to figure out the bare min dependencies needed to make that JS example work
22:03:50FromGitter<zacharycarter> yup
22:04:05FromGitter<zacharycarter> okay yarn is facebook's JS package manager
22:04:14FromGitter<zacharycarter> NPM is the open source one
22:04:21FromGitter<zacharycarter> package.json is equivalent to a nimble file in Nim
22:04:32FromGitter<kaushalmodi> yes, I only got that last part :P
22:04:49FromGitter<kaushalmodi> but it's not clearly where querystring is coming from
22:05:05FromGitter<zacharycarter> actually
22:05:08FromGitter<kaushalmodi> It would have been nice to just know a .js I need to put in the site footer to make that thing work
22:05:09FromGitter<zacharycarter> I think it's a NodeJS module
22:05:24FromGitter<zacharycarter> https://nodejs.org/api/querystring.html
22:05:38FromGitter<kaushalmodi> oh, thanks
22:05:40FromGitter<zacharycarter> so that nim code probably needs to get compiled with the nodeJS define
22:05:40FromGitter<zacharycarter> np
22:05:42FromGitter<kaushalmodi> *how do you know?*
22:05:50FromGitter<zacharycarter> you don't
22:06:02FromGitter<zacharycarter> you just throw your hands in the air and say CURSE YOU JAVASCRIPT
22:06:09FromGitter<zacharycarter> YOU ARE ALL THAT IS EVIL AND BAD IN THE WORLD!
22:06:31*PrimHelios_ joined #nim
22:06:34FromGitter<kaushalmodi> "with the nodeJS define"?
22:06:37FromGitter<zacharycarter> or you install a bunch of VSCode intellisense plugins and hope you can ctl + click through
22:06:41FromGitter<kaushalmodi> you mean `-d:nodeJS`?
22:06:44FromGitter<zacharycarter> yes
22:07:59FromGitter<kaushalmodi> no luck..
22:08:02FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd39042ab17df2631f6b3f4]
22:08:36FromGitter<kaushalmodi> compiles fine without that define
22:08:41FromGitter<zacharycarter> hmmm
22:08:50FromGitter<kaushalmodi> nim code: https://ptpb.pw/_kb5/nim
22:09:58FromGitter<zacharycarter> I'll take a stab at it
22:11:13FromGitter<kaushalmodi> I am able to convert 4/7 JS funcs from https://github.com/netlify/netlify-functions-example/tree/master/src/lambda
22:11:49FromGitter<kaushalmodi> remaining: hello_name_post, hello_fetch, and hello_slack (I'll give up on this as I don't use slack :P)
22:12:11FromGitter<zacharycarter> @kaushalmodi - with nim 0.19.0 that compiles fine for me
22:12:19FromGitter<zacharycarter> `A-TD1EQGTFM:sell-my-car zachcarter$ nim js -d:nodejs foo.nim`
22:12:47FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5bd3915eab17df2631f6bb24]
22:13:08FromGitter<kaushalmodi> huh.. I am on latest devel built yest
22:13:19FromGitter<zacharycarter> let me upgrade to devel
22:15:06FromGitter<kaushalmodi> ok, found the problem.. nim bug
22:15:14FromGitter<kaushalmodi> I had to remove all config.nims that came in the search path
22:15:20FromGitter<zacharycarter> ahhh okay
22:15:24FromGitter<zacharycarter> 👍
22:15:31FromGitter<zacharycarter> now you get to open the JS file and see the JS errors :P
22:16:44FromGitter<kaushalmodi> adding the define didn't actually change the js
22:16:52FromGitter<kaushalmodi> except for the random name changes
22:18:33FromGitter<kaushalmodi> ok, I need to chase this later
22:18:39FromGitter<kaushalmodi> thanks for your time!
22:19:13FromGitter<zacharycarter> np!
22:19:22FromGitter<zacharycarter> I mean the JS produced by the import statement thing
22:19:33FromGitter<zacharycarter> @kaushalmodi - ping me when you're working on it again if you're having trouble - glad to help whenever I can
22:19:40FromGitter<kaushalmodi> thanks!
22:19:48FromGitter<zacharycarter> are these AWS lambda jobs?
22:19:50FromGitter<zacharycarter> btw?
22:19:51FromGitter<kaushalmodi> this is where I am right now
22:20:03FromGitter<kaushalmodi> Netlify runs AWS lambda jobs in the backend
22:20:07FromGitter<kaushalmodi> but it errors with https://nim-lambda-functions.netlify.com/.netlify/functions/hello_name_post
22:20:39FromGitter<kaushalmodi> and this is the JS code generated with nim js -d:nodejs ..: https://github.com/kaushalmodi/nim-netlify-functions/blob/master/src/lambda/nimcache/hello_name_post.js
22:21:11FromGitter<zacharycarter> well - I know you can create lambda jobs using Nim's C target
22:21:18FromGitter<zacharycarter> although it requires a Python bridge - but I've done it before
22:21:35FromGitter<kaushalmodi> that's another blackhole for me
22:21:39FromGitter<zacharycarter> I think it's probably possible now to create a Nim C target for lambda jobs - the same way AWS implemented Golang's
22:21:56FromGitter<zacharycarter> but using the nodejs backend is perfectly viable as well
22:22:00FromGitter<kaushalmodi> in any case got to go for now
22:22:05FromGitter<zacharycarter> okay - talk soon!
22:27:37FromGitter<Mobilpadde> Hey, got another question :D - How do I mark an exported variable (is a seq with procedures in) as gcsafe? Because with `--threads:on`my program won't compile :/
22:31:15FromGitter<recloser> is it a global var?
22:31:31FromGitter<Mobilpadde> Yea
22:31:37FromGitter<recloser> "We call a proc p GC safe when it doesn't access any global variable that contains GC'ed memory (string, seq, ref or a closure) either directly or indirectly through a call to a GC unsafe proc."
22:31:57FromGitter<Mobilpadde> Oh
22:32:08FromGitter<Mobilpadde> How do I make it not global? :D
22:32:46FromGitter<Mobilpadde> Still exported for *one* other module to use
22:33:08FromGitter<recloser> hmm
22:33:32FromGitter<recloser> does it actually need to be a seq or can it be an array?
22:33:53FromGitter<Mobilpadde> Can be an array :D
22:34:14FromGitter<Mobilpadde> Sorry, I'
22:34:53FromGitter<recloser> so this is just a constant array like `var blah = @[someproc1, someproc2]`?
22:35:11FromGitter<recloser> i mean, a constant seq, right now
22:35:27FromGitter<Mobilpadde> `let stuff = @[proc1, proc2]`
22:35:33FromGitter<Mobilpadde> Yea
22:36:58FromGitter<recloser> just drop the `@` to make it an array
22:37:40FromGitter<recloser> and make sure the procs have a `{.nimcall.}` pragma
22:37:40FromGitter<Mobilpadde> Okay, fixed by removing the `@`, now I have another problem though, with an array of regexii
22:38:07FromGitter<Mobilpadde> Or whatever it is in plural
22:38:08FromGitter<Mobilpadde> :D
22:38:54FromGitter<recloser> regexes
22:39:09FromGitter<Mobilpadde> :D
22:39:32FromGitter<Mobilpadde> Though, do you know how I can get it to be gcsafe?
22:40:08*PrimHelios_ quit (Remote host closed the connection)
22:40:31FromGitter<recloser> an array of regexes?
22:40:36*vlad1777d_ joined #nim
22:40:37FromGitter<recloser> i think that involves gc allocated memory
22:40:49FromGitter<Mobilpadde> Yea
22:41:01FromGitter<recloser> so i don't think you can make that gcsafe
22:41:09FromGitter<Mobilpadde> Like: `re"\w+"`
22:41:13FromGitter<Mobilpadde> Hmm
22:41:22FromGitter<recloser> make it a threadvar?
22:41:23FromGitter<Mobilpadde> Do you know a work-a-round?
22:41:35FromGitter<Mobilpadde> Sec.
22:41:57FromGitter<Mobilpadde> Getting this error `thread var cannot be initialized explicitly; this would only run for the main thread`
22:42:14FromGitter<Mobilpadde> Only care about it for the main thread, though
22:42:23FromGitter<Mobilpadde> But it won't compile :/
22:42:51FromGitter<recloser> i think it should compile if you aren't accessing it from outside the main thread
22:43:43FromGitter<Mobilpadde> Maybe because I'm using it in asynchttpserver?
22:44:25FromGitter<recloser> not sure, i've never used that
22:45:41FromGitter<Mobilpadde> :/
22:47:11FromGitter<zacharycarter> maybe check out the gcsafe / threadvar pragmas @Mobilpadde - https://nim-lang.org/docs/manual.html#threads-gc-safety
22:47:21FromGitter<zacharycarter> not sure what you're trying to do exactly - if you can share some code, that could help
22:47:58FromGitter<recloser> are you trying to access the regexes from the async callback passed into asynchttpserver serve?
22:49:27FromGitter<Mobilpadde> Yea
22:54:54FromGitter<recloser> maybe instead just do something like ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ and access the regexes through `getRegexes`? [https://gitter.im/nim-lang/Nim?at=5bd39b3eef4afc4f28d912cf]
22:56:01FromGitter<Mobilpadde> Hmm, will try! :D
23:01:00FromGitter<Mobilpadde> Thank you so, so much! It's working! :D
23:01:55FromGitter<recloser> np
23:07:49*kapil____ quit (Quit: Connection closed for inactivity)
23:07:54*elrood quit (Quit: Leaving)
23:09:16FromGitter<Mobilpadde> 'nother question, why does this ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ throw this: `'parallel' section without 'spawn'`? [https://gitter.im/nim-lang/Nim?at=5bd39e9c271506518d76c70b]
23:10:06FromGitter<Mobilpadde> I think it's much like what they do in their manual? https://nim-lang.org/docs/manual.html#parallel-amp-spawn-parallel-statement
23:12:26FromGitter<Mobilpadde> What I'm trying to do is run another thread/process in parallel with main. Checking for something every hour
23:13:50FromGitter<Mobilpadde> Not sure I understand parallel right :p
23:14:11FromGitter<zacharycarter> parallel is just adding some extra checks to the compiler I believe
23:14:28FromGitter<zacharycarter> so it enforces a certain set of rules in the block that follows it
23:15:30*Elronnd quit (Ping timeout: 264 seconds)
23:15:56FromGitter<Mobilpadde> Ohh
23:16:10FromGitter<Mobilpadde> Got it working, though. Without parallel :D
23:17:56FromGitter<zacharycarter> I've rarely used parallel / spawn
23:18:27FromGitter<zacharycarter> maybe once or twice in projects - and I find the threadpool module to be more of a headache to work with, than the value I get from it - but I'm not an expert on its implementation or usage either
23:19:05FromGitter<Mobilpadde> Understandable :p
23:19:12FromGitter<Mobilpadde> Much the same here :D
23:21:03FromGitter<zacharycarter> :)
23:36:30*endragor joined #nim
23:40:53*endragor quit (Ping timeout: 245 seconds)