<< 22-05-2020 >>

00:00:23Yardanicoyeah, I don't see using being used often (pun intended)
00:01:02Yardanicobut it's not even an experimental feature
00:01:11Yardanicoso it's there to stay for all time nim 1.x will exist
00:01:54Yardanicoof course in nim 2.0 we'll all just tell the compiler to write code for us
00:02:16FromDiscord<Recruit_main707> Who would want that
00:02:21Yardanicoalso another interesting thing is how people write case statements
00:02:30FromDiscord<Recruit_main707> Writing Nim is enjoyable
00:02:33Yardanicothere are 4 ways of indenting/writing them in Nim
00:03:34Yardanicohttps://play.nim-lang.org/#ix=2mWz
00:03:38YardanicoI prefer the 4th one btw
00:04:22*leorize quit (Remote host closed the connection)
00:04:51*leorize joined #nim
00:05:05Yardanicothe manual covers this though so it's all fine
00:06:52FromDiscord<exelotl> Only villains use #2 or #3
00:06:57leorize[m]disruptek's fav is the 3rd
00:07:33*rockcavera quit (Read error: Connection reset by peer)
00:07:44Yardanico@exelotl I dislike 1st and 2nd ones
00:07:47Yardanico3rd and 4th are fine imo
00:07:48FromDiscord<Recruit_main707> 1st one
00:07:54*rockcavera joined #nim
00:08:04YardanicoI don't like extra indentation there for some reason :P
00:08:33FromDiscord<exelotl> If there's a : then there should be indentation following it
00:08:39Yardanicohmm
00:08:39FromGitter<xmonader> what is the difference between 1, 2 AND 3,4 ?
00:08:45Yardanicono difference
00:08:47Yardanicojust how it loks
00:08:52Yardanicothey all work exactly the same
00:09:06FromGitter<xmonader> yeah i understand, i just can't see the difference between 1 and 2
00:09:07FromDiscord<exelotl> I usually use #4 anyways
00:09:12Yardanico@xmonader indetation
00:09:16FromGitter<xmonader> also can't see the difference in 3,4
00:09:16FromDiscord<Recruit_main707> Wether there is : in the first line of each
00:09:18Yardanicoah sorry
00:09:19Yardanico:
00:09:20Yardanicoyeah
00:09:24leorizeas someone who wrote indent scripts for Nim, I hate 2, 3
00:09:27Yardanico@xmonader the diff between 1 and 2 is the colon
00:09:35Yardanicosame for 3 and 4
00:09:56FromGitter<xmonader> ah thanks, I've some visual problems I don't see things easily
00:10:59FromDiscord<Rika> I would use 1 but I do not
00:11:13FromDiscord<Rika> I use 4 instead because styling told me to
00:11:29FromGitter<xmonader> I think ⏎ `match a with ` without colon makes more sense to me
00:18:09*samuelb_ quit (Quit: Leaving)
00:23:06*bbarker joined #nim
00:25:27*krux02_ quit (Remote host closed the connection)
00:26:15*Brandon__ quit (Ping timeout: 256 seconds)
00:37:24FromGitter<bung87> does the vscode editor format follow this ? https://nim-lang.org/docs/nep1.html#introduction-conventions-for-multiminusline-statements-and-expressions , I have not run format command successfully for a while.
00:41:30Yardanicoformat command uses nimpretty
00:41:34Yardanicobut it was fixed only recently in the extension
00:41:37Yardanicoand nimpretty itself has bugs
00:45:06FromGitter<bung87> ok, what's your editor for nim?
00:45:16*gxt__ joined #nim
00:45:30Yardanicosublime text 3 (nimlime + nimlsp), but I don't really use nimpretty anyway
00:45:41YardanicoI didn't say vscode is bad, but the extension has it's own problems :)
00:46:42FromGitter<bung87> I know the author almost maintained alone.
00:46:43*gxt_ quit (Ping timeout: 240 seconds)
00:46:55Yardanicowell same goes for nimlsp and for nimlime
00:49:26*konvertex quit (Ping timeout: 264 seconds)
00:50:03dadadajeder Mensch (nicht ich) mit Microsoft Office arbeitet, ..., also ist diese Software zentral für die Menschheit, sie gehört zugleich nicht der Menschheit, bedenklich,
00:50:23dadadasry, the message was for Araq ... :-)
00:51:28Yardanicohe's sleeping now I think :P
00:51:28FromGitter<bung87> dont worry
00:51:56FromGitter<bung87> Latest commit 4 hours ago
00:52:09Yardanico?
00:52:23FromGitter<bung87> araq
00:52:24Yardanicowell yes
00:52:33Yardanicoit was ~23:00 there 4 hours ago
00:52:36Yardaniconow it's ~2:52 AM
00:52:39Yardanicoin Germany\
00:52:56FromGitter<bung87> yeah time for sleeping
01:00:52Yardanicocan you guys test if the example from https://github.com/nim-lang/Nim/issues/14425 crashes for you with --gc:arc or not?
01:04:36*lritter_ joined #nim
01:04:47*lritter quit (Ping timeout: 272 seconds)
01:09:15FromDiscord<speckledlemon> Does a tool for generating package templates exist other than <https://github.com/hiway/cookiecutter-nim-cli> ?
01:09:28Yardaniconimble itself makes a package template for you
01:09:35Yardanicowith src dir, tests dir, nimble file
01:10:06Yardanicoand this extension seems to do the same but worse :P
01:10:11Yardanicotry "nimble init"
01:10:21*zacharycarter joined #nim
01:11:25FromDiscord<speckledlemon> thanks!
01:11:44Yardanicoalso see https://github.com/nim-lang/nimble#creating-packages
01:13:15FromDiscord<JSGrant> _kinda wishes that choosenim would be part of the normal 'tools' distribution_
01:13:19Yardanicono
01:15:15FromDiscord<JSGrant> Yandanico: Is that in-reference to me, or? lol
01:15:20Yardanicoyes
01:15:39FromDiscord<JSGrant> Any reasoning behind it, or?
01:16:07Yardanico1) it's not cross-platform (no windows support) 2) if you have nim repo (or nim distro downloaded), you don't really need choosenim IMO
01:16:31YardanicoI only would agree if it would actually be coupled with koch and stuff so it would update the files you installed and not install nim somewhere else
01:17:17YardanicoI don't think there are any languages which _ship_ a version chooser with the compiler
01:17:28Yardanicowell, at least the ones I know of
01:18:37FromDiscord<JSGrant> Well, maybe not ship; But as-far as I can tell -- Rust officially supports and actively mentions rustup?
01:19:36FromDiscord<JSGrant> _also doesn't know enough (or next to anything, honestly) about the architecture of choosenim -- but these mostly sound like missing features (sans argument 2)?_
01:21:28FromDiscord<JSGrant> Evidently as-per the rustup site; The footer does mention " rustup is an official Rust project. "
01:22:08FromDiscord<JSGrant> But as-said if the distinction is "shipped" I think that's a fair distinction
01:26:37*chemist69 quit (Ping timeout: 260 seconds)
01:28:38*chemist69 joined #nim
01:40:20*sz0 quit (Quit: Connection closed for inactivity)
01:41:55*nphg1 joined #nim
01:44:11*nphg quit (Ping timeout: 246 seconds)
02:19:23*martinium joined #nim
02:19:56martiniumI am trying to play around with parallel processing in Nim. I am trying to experiment making a simple line counting program multi-core/parallel
02:20:26martiniumany good Nim resources for writing parallel/multicore code?
02:26:20zedeushttps://github.com/mratsim/weave
02:26:27FromDiscord<Elegant Beef> Nim in action has a fairly good chapter on it
02:27:04*team\andinus joined #nim
02:27:43martiniumman this library looks reallll nice
02:27:49martiniumthanks zedeus
02:36:03*muffindrake quit (Ping timeout: 260 seconds)
02:38:01*muffindrake joined #nim
02:43:02*fredrikhr quit (Quit: Client Disconnecting)
02:48:22*zacharycarter quit (Ping timeout: 260 seconds)
02:50:08FromGitter<xmonader> any idea how to fix that ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec73de03ffa6106f1c7e5b5]
02:50:17*Tongir joined #nim
02:50:26FromGitter<xmonader> different lock levels :/
02:52:57*Tlanger quit (Ping timeout: 260 seconds)
02:53:28*audiofile quit (Quit: Going offline, see ya! (www.adiirc.com))
02:55:06FromGitter<xmonader> this code was valid in nim 1.0 ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec73f09225dc25f549a96f9]
03:05:46*Tlanger joined #nim
03:08:28*Tongir quit (Ping timeout: 256 seconds)
03:08:35*endragor joined #nim
03:15:46*waleee-cl quit (Quit: Connection closed for inactivity)
03:19:31*Senketsu joined #nim
03:28:08*chemist69 quit (Ping timeout: 244 seconds)
03:28:40*dadada quit (Ping timeout: 265 seconds)
03:29:12*chemist69 joined #nim
03:35:32*zacharycarter joined #nim
03:58:18*thomasross quit (Ping timeout: 260 seconds)
04:00:30*NimBot joined #nim
04:06:02*supakeen quit (Quit: WeeChat 1.9.1)
04:06:39*supakeen joined #nim
04:10:40*rockcavera quit (Remote host closed the connection)
04:40:19*rmt quit (Quit: Leaving)
04:41:21zacharycarterwhat does `(unsigned short)-1` mean in C/C++?
04:41:32zacharycarterlike one minus the limit of unsigned short?
04:42:14zacharycarteroh I guess it his the limit
04:42:29zacharycarterlearn something new every day - I was always very confused by this
04:44:09PrestigeIs out xrandr wrapper incomplete?
04:45:02zacharycarterhuh?
04:45:28Prestigeis our*
04:46:08zacharycarterno idea...
04:46:27PrestigeMaybe XRRGetCrtcInfo isn't supposed to be in there? But I'm seeing a call to it in xrandr.c
04:46:27zacharycarterdidn't even know what xrandr was until just now
04:47:05zacharycarterso far 900ish lines of imgui ported to Nim - working on a test backend with sokol, just got the default font loaded I think
04:47:18zacharycartershould hopefully be able to render a window by tomorrow
05:04:22*dddddd quit (Ping timeout: 265 seconds)
05:06:00*sbeam joined #nim
05:09:23*sbeam quit (Client Quit)
05:14:15disruptekcool, i'd like to use it for this poe project.
05:14:53zacharycarter I think eventually I want to port sokol to Nim too
05:15:06zacharycarterI started on this once and got decently far but I should finish that port as well
05:15:41disrupteki realized recently that i don't care about supporting other platforms. let other people submit PRs for windows, etc.
05:15:50disrupteki'm in the "make it work" phase.
05:16:18zacharycarteryeah - I agree
05:16:48zacharycarterwell kind of anyway - eventually shit needs to work across 64 bit os's
05:16:58zacharycarterbut it might as well work on one first
05:17:27PrestigeHm if I have a ptr T and want to get the next location in memory how can I access it? Like myPtr[1]
05:18:04zacharycarterI'm going to bed - cya all tomorrow
05:21:41shashlickdisruptek what you working on
05:21:57PrestigePerhaps an unchecked array to wrap the variable and then I can access it
05:25:33leorize[m]Prestige: cast it to ptr UncheckedArray[T]
05:26:02PrestigeAh thanks leorize[m]
05:31:27*narimiran joined #nim
05:34:49PrestigeNot sure if I'm doing this incorrectly: https://0x0.st/i9dl.png the first echo is fine, the second gives me an illegal storage access error leorize[m]
05:35:07*zacharycarter quit (Ping timeout: 260 seconds)
05:36:20PrestigeI thought sizes[0] would be the same pointer as pSizes
05:37:44leorize[m]you have to cast `ptr T` into `ptr UncheckedArray[T]` not `ptr UncheckedArray[ptr T]` :P
05:38:52PrestigeI see, thanks that worked
05:42:15*solitudesf joined #nim
05:46:16*martinium quit (Ping timeout: 258 seconds)
06:00:19*couven92 quit (Read error: Connection reset by peer)
06:00:24*fredrikhr joined #nim
06:19:44*fredrikhr quit (Read error: Connection reset by peer)
06:19:50*couven92 joined #nim
06:19:50*lritter_ quit (Quit: Leaving)
06:20:11*couven92 quit (Read error: Connection reset by peer)
06:20:33*fredrikhr joined #nim
06:25:14team\andinushttps://nim-lang.org/docs/times.html
06:25:34team\andinushow do i get current time in this format? (Wed, 18 Mar 2020 13:59:19 +0530)
06:25:55team\andinusnow().format("ddd, dd MMM yyyy hh:mm:ss zz") returns Fri, 22 May 2020 11:52:28 +05
06:25:58team\andinusand
06:26:18FromDiscord<Rika> ?
06:26:21FromDiscord<Rika> i dont see the issue
06:26:22team\andinusecho now().format("ddd, dd MMM yyyy hh:mm:ss zzz") returns Fri, 22 May 2020 11:52:11 +05:30
06:26:36team\andinusissue is i want +0530
06:26:54team\andinusit returns +05 on "zz" and +05:30 on "zzz"
06:27:22*nphg1 is now known as nphg
06:27:27*Faulander quit (Read error: Connection reset by peer)
06:27:38team\andinusdo i have to write something to remove ':' manually or can times package do this?
06:27:55*Faulander joined #nim
06:29:09team\andinusthis is for email header btw
06:29:18leorizethat's not supported from what I can tell
06:29:54leorizeyou can do your own formatting though, `.utcOffset` stores the offset
06:32:46team\andinusi c
06:32:53team\andinusis this a bug? https://play.nim-lang.org/#ix=2mXj
06:33:24team\andinusit should return "Fri, 22 May 2020 06:33:00 +00:00" right?
06:53:56*opDispatch joined #nim
06:59:18opDispatchwhat's better for nim ? vim or emac ?
06:59:33FromDiscord<Rika> either
06:59:48FromDiscord<Rika> is your nickname really `opDispatch` or is yardanico's bridge bugged?
07:00:43opDispatchno it's opDispatch. This is a powerful operator overload in dlang.
07:01:48opDispatchin short, when you write "a.b" and if "a" has no "b" member, opDispatch is called at compile time to let you solve "b".
07:02:06FromDiscord<Rika> yeah, since there's something called `opDispatch` too in the library the bot is using lol
07:02:13FromDiscord<Rika> some of us thought it was a bug
07:02:19opDispatchah ok I see.
07:02:43FromDiscord<Rika> nim doesnt need no op dispatch!
07:02:50FromDiscord<Rika> weve got ufcs 😛
07:03:03FromDiscord<Rika> but from what ive heard, vim is better for nim
07:03:12opDispatchD too but opDispatch is still necessary in some cases
07:03:13FromDiscord<Rika> but nim also has an LSP implementation
07:03:52opDispatchthing JSON chain, e.g a["b"]["c"] = "prop", can be written a.b.c = "prop"
07:04:04opDispatch*think
07:04:32opDispatchwith safe access in case the sub objects dont exist
07:05:17opDispatchanyway, I guess LSP is the way to go nowadays...
07:07:15*sz0 joined #nim
07:08:12FromDiscord<Rika> sometimes that json dot-operator idea can backfire, what if you have a proc with the same name as a key and a newbie didnt realize that?
07:09:43opDispatchyou can start the chain from a special type, e.g prop = JSONChain(myJSONValue).a.b.unwrap();
07:10:04opDispatchso that from the special type it's clear that solving is done in a special fashion
07:11:26opDispatchlook at my stuff for that to get a better idea, https://gitlab.com/basile.b/iz/-/blob/master/import/iz/sugar.d#L2096
07:13:01*Senketsu quit (Ping timeout: 272 seconds)
07:13:32FromDiscord<Rika> hmm, i think thats possible too in nim, but also possibly needs an experimental feature
07:13:44opDispatchAST macros maybe ?
07:15:53FromDiscord<Rika> dot operators
07:15:55FromDiscord<Rika> prolly
07:16:07leorizeyea we do have dot operators
07:16:26FromDiscord<Rika> https://nim-lang.org/docs/manual_experimental.html#special-operators-dot-operators was right
07:16:49opDispatchare Nim operators tied to a struc/record or can they freestand ?
07:17:11FromDiscord<Rika> freestand?
07:17:25opDispatchi.e free functions at the global scope
07:17:35opDispatchVS member functions
07:17:39leorizenim don't have functions tied to a sobject
07:17:40FromDiscord<Elegant Beef> We have UFCS so they're the same
07:17:41FromDiscord<Rika> me dumb me no understand
07:17:44FromDiscord<Rika> oh
07:17:45leorizenim don't have member functions
07:17:46FromDiscord<Rika> that
07:17:54FromDiscord<Elegant Beef> They behave the same i should say
07:18:19FromDiscord<Elegant Beef> if left hand matches the first param it's passed in
07:18:57opDispatchsorry, I should have precised that I'm in the process of asking myself if I should dive in a new PL or not, so I know nothing of Nim ;)
07:19:14FromDiscord<Elegant Beef> Everyone here will say use nim 😛
07:19:52FromDiscord<Rika> that is fine
07:19:57FromDiscord<Elegant Beef> D and nim share a lot i believe
07:20:09leorizeyou can ask @timotheecour
07:20:13FromDiscord<Rika> i should read into d too i guess it looks interesting to me
07:21:37FromDiscord<Elegant Beef> From my understanding is it's practically nim but with cleaner C syntax instead of python like 😄
07:21:59leorizenah, it's very much different :P
07:22:09FromDiscord<Elegant Beef> Yea i've not looked into it
07:23:06leorizenim is much more flexible however
07:23:53FromDiscord<Rika> how?
07:25:33leorizeiirc D doesn't distinguish between gc-ed mem and unmanaged
07:26:48leorizealso we have, uh, proper ufcs :P
07:26:57FromDiscord<Rika> whats improper about theirs
07:26:57FromDiscord<Rika> lmao
07:28:12leorizehttps://github.com/timotheecour/D_vs_nim
07:28:21leorizeaccording to this, no ufcs for locals?
07:28:21FromDiscord<Rika> 😮 nice thanks
07:28:29leorizethe material is old though
07:28:34leorizetake it with a grain of salt
07:28:40FromDiscord<Rika> > UFCS supported everywhere ↵this is a lie
07:28:48FromDiscord<Rika> i can tell one place where ufcs does not work
07:29:01FromDiscord<Rika> and that is `toSeq` and its compile-time brothers
07:29:19opDispatchactuall about D memory, the library i linked previously has a whole system of manual management.
07:30:15opDispatchbut it's true that mixing manual and GC are a PITA and usually requires work or a specialized library
07:30:21FromDiscord<Rika> sounds like a pain
07:31:47opDispatchthe problem is when you mix the two in an agreggate. Roots to GC stuff that are located in manually allocated aggregates must be manually declared to the GC otherwise it can abruptly free them
07:32:37leorizewell that's definitely a pita
07:32:57opDispatchthis problem is solved using deep static introspection of members and attributes
07:34:17FromDiscord<Rika> small question, it says nim has no raii
07:34:22FromDiscord<Rika> now it does, right?
07:34:26FromDiscord<Rika> i know the repo is ol
07:34:27FromDiscord<Rika> d
07:34:35leorizewe don't have RAII
07:34:51leorizedestructors is not RAII, mind you :P
07:34:52alehander92oii
07:35:03leorizeor is it?
07:35:05leorizenot sure :P
07:35:39*leorize quit (Remote host closed the connection)
07:35:39*gxt__ quit (Write error: Connection reset by peer)
07:35:39*opal quit (Read error: Connection reset by peer)
07:38:11*opal joined #nim
07:42:18*gxt__ joined #nim
07:43:52*Trustable joined #nim
07:45:12*jwm224 quit (Ping timeout: 260 seconds)
07:47:06*jwm224 joined #nim
07:47:49FromGitter<gogolxdong> Can acyclic , cursor ,etc. pragma be removed with --gc:orc ?
07:50:17*opDispatch is now known as TypeNull
07:51:24FromDiscord<Rika> huh D has a lot of keywords
07:52:49TypeNullyeah, and many a reused so it could be worse
07:53:34FromGitter<gogolxdong> I mean these keywords are related to cycle reference, if I'm right, which is resolved by orc, so wondering whether these could be removed.
07:53:46TypeNullsadly it has no syntax to use them as identifier
07:54:02FromDiscord<Rika> ooh, new person?
07:54:10FromDiscord<Rika> hello owo
07:54:25TypeNulleven FreePascal can dot this, e.g const &begin: integer;
07:54:38FromDiscord<Rika> @gogolxdong: i wasnt referring to you,
07:54:40FromDiscord<Rika> sorry*
07:55:00FromDiscord<Rika> https://github.com/nim-lang/RFCs/issues/34↵this looks interesting
07:57:21TypeNullno it doesnt
07:57:49TypeNullmaybe the link that work does more ;)
07:58:12TypeNullhttps://github.com/nim-lang/RFCs/issues/34
07:58:29*Vladar joined #nim
07:58:57TypeNullah the autor is timothee. This guy is good, he has written his own D compiler a few years ago
07:59:32TypeNullmmmh maybe I mismatch him with someone else
07:59:57FromDiscord<Rika> it works on discord /shrug
08:01:17TypeNullyeah it's Timon Gehr that has written a D compiler not RFC34's author
08:01:52*leorize joined #nim
08:02:10TypeNulllooks like the link contained a LF, just because "this"
08:02:20TypeNull*before
08:02:23FromDiscord<Rika> yeah, i added that
08:03:13Araqgogolxdong: that is true but .acyclic and .cursor help the ORC too
08:03:32FromDiscord<Rika> @willyboar smh
08:03:42Araqbut you can leave them out and add them in after profiling shows it's worth it
08:04:15FromDiscord<willyboar> sorry can't resist
08:05:37*TypeNull left #nim ("Konversation terminated!")
08:10:26FromGitter<timotheecour> @araq I’m peering though sysstr.nim an I’m noticing realloc is not called in many (all) places, so you’re forcing a realloc for string/seq pessimistically; am I missing something?
08:13:53AraqI don't understand the question
08:16:13Araqmaybe sysstr.nim is in worse shape than I remember it ;-)
08:19:30FromGitter<timotheecour> So the classic std::vector algorithm for resizing is to use realloc when capacity < newLen; but where when space < newLen, a new seq/string is created instead, whereas realloc MAY reuse same memory if OS has enough space past capacity
08:21:13FromGitter<timotheecour> @Rika ⏎ ⏎ > <FromDiscord>** <Rika> > UFCS supported everywhere ↵this is a lie ⏎ ⏎ instead of saying it’s a lie, send a PR next time please ;-) ? I’ve updated https://github.com/timotheecour/D_vs_nim/commit/4baa152fe75f70dd999b4b485194fca5b927b03c [https://gitter.im/nim-lang/Nim?at=5ec78b794c9b0f060d17e1c0]
08:21:19AraqI'm well aware of the algorithm and we try to do the same :-)
08:22:31FromGitter<timotheecour> for example here: `result = cast[PGenericSeq](newSeq(typ, r))`
08:23:51*neceve joined #nim
08:24:54FromGitter<xmonader> can someone help with that error? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec78c56ff7a920a7204abcd]
08:25:29FromGitter<xmonader> that's what im trying to do https://github.com/xmonader/nim-servy/commit/8dc04ed25a66990bd664da72c645166fe706c7a2
08:25:33*liblq-dev joined #nim
08:27:47leorizeyou're trying to capture a mutable variable into a closure
08:28:07leorizethat's forbidden, it's unsafe
08:28:21leorizenot mutable variable but `var` reference
08:28:29FromGitter<xmonader> that used to work :(
08:28:42FromGitter<xmonader> even when i converted it to a proc, still didn't work..
08:29:12leorizewhy are you writing closures instead of procs though?
08:33:08leorizeI can see why this is unsafe when you put async in, but this should be safe without async
08:33:12leorizeprobably a bug
08:33:25leorizebut you should write actual procs though
08:33:37FromGitter<xmonader> it sounded more intuitive as API, but I'm changing it to procs yet https://github.com/xmonader/nim-servy/commit/4fbe64d3f103145f2ed0c3aacf442448e83ca839
08:33:57FromGitter<xmonader> @leorize yes, it worked without aysnc indeed
08:34:10FromGitter<xmonader> I'm changing all procs to async to unify with the websocket lib
08:34:24leorizeplease never do things like that :P
08:34:31leorizeasync is overhead piled on overhead
08:34:38leorizeonly use it when you need it
08:35:07FromGitter<xmonader> well, not sure i know the way around it in that case
08:35:31FromGitter<xmonader> I can try removing it again and see where I reach, but if a language feature I can'tuse as I expect it's shame :(
08:35:55leorizewell it depends
08:36:03leorizeif you want async io then ofc async is the way to go
08:36:09leorizebut remember that everything has a cost
08:37:10leorizeoh and nimcall can be passed as closure iirc
08:37:53leorizeI'm not sure why your logger even need R/W access to the request and response though
08:38:25leorizeand the design of these look like they need to be done synchronously
08:38:34FromGitter<xmonader> it's an example middleware
08:38:43FromGitter<xmonader> some of them will manipulate the request headers for instance
08:39:05FromGitter<xmonader> e.g cors middleware
08:39:11leorizeah, I see
08:39:21leorizeif you want to pass mutable things into async stuff, use ref
08:39:45FromGitter<xmonader> and then addrof right?
08:39:53FromGitter<xmonader> let me quickly try that thank you
08:40:02leorizeno, please no :P
08:40:24leorizeit means making Request and friends `ref object`
08:40:32leorizethis is the fundamental problem with async
08:41:09leorizesince you are gonna swap context around, a `var` that you captured might no longer be there the next time your function resumes
08:41:24leorizethis is why capturing `var` is unsafe
08:41:43FromGitter<xmonader> aha :( will try that ^_^
08:43:49skrylar[m]hoi
08:44:21Prestigeo/
08:56:18*abm joined #nim
09:05:09*endragor quit (Remote host closed the connection)
09:06:58*letto_ joined #nim
09:07:24FromGitter<xmonader> @leorize it works only one problem I want also a function that generates handler objects e.g static middleware https://github.com/xmonader/nim-servy/blob/master_ws_mem/src/servy.nim#L887 ⏎ ⏎ problem is it returns a closure, ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/nim-lang/Nim?at=5ec7964c9da05a060a23aee7]
09:08:00*letto quit (Ping timeout: 272 seconds)
09:11:54leorizeasync and nimcall don't go together :P
09:12:01leorizeyou're tagging so much
09:12:14leorizedon't tag unless you have to :P
09:13:19leorizechange your proc types
09:13:31leorizejust put closure in there and remove everything else
09:15:42*endragor joined #nim
09:16:25FromGitter<xmonader> hmm it's still expecting {.gcsafe, locks: <unknown>.}' after their removal
09:16:46FromGitter<xmonader> ```code paste, see link```
09:20:21FromGitter<xmonader> also changing the signature to that ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec79955778fad0b131c0d57]
09:23:57leorizea rule of thumb, ignore {.locks.}
09:24:04leorizeit's not used by any nim code in circulation
09:24:26leorizealso remove `{.async.}`
09:24:44leorize`{.async.}` is a transformer, it has little to no meaning in a proc type
09:25:08*s4mu3lbk joined #nim
09:25:09leorizethough we should just adjust the macro to generate the `{.closure.}` tag for proc types instead
09:26:11*s4mu3lbk quit (Remote host closed the connection)
09:26:41*s4mu3lbk joined #nim
09:28:42FromGitter<bung87> {.bycopy.}{.byref.} only annotation for type?
09:29:58FromGitter<timotheecour> {.Evalonce .} (need to update that PR)
09:30:43leorizebung87: unless you're interfacing with C, don't use it
09:31:18FromGitter<bung87> ok
09:31:49FromGitter<bung87> alaviss is you?
09:33:23leorizeyea
09:34:00FromGitter<timotheecour> not sure how it relates to C btw
09:34:10FromDiscord<dom96> Why do people not just get consistent nicks? 😛
09:34:35skrylar[m]i do that '_'
09:34:54FromGitter<bung87> about SQLITE_TRANSIENT ,SQLITE_STATIC , safety is first? then make it to SQLITE_TRANSIENT by default
09:35:09*dadada joined #nim
09:35:20leorizeyea, though we should think if exposing the entire `bind` process is a good idea
09:35:32*dadada is now known as Guest91926
09:35:54leorizetimotheecour: `{.bycopy.}` and `{.byref.}` signify how a parameter will be passed
09:36:09FromGitter<bung87> ok,then I make it default.
09:36:12leorizeit's only relevent when you're interfacing with C, since they have strict pass-by-value
09:36:23leorizerelevant*
09:36:27FromGitter<timotheecour> no that’s not what this feature is about at all
09:36:41FromGitter<bung87> I can grab bind proccess from ormin :P
09:37:04FromGitter<xmonader> @leorize like that? https://gist.github.com/xmonader/305fa8172d689bfd73abf88bdb5dadb5 ⏎ because with that still getting ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec79d407da67d06fac47848]
09:37:05leorizetimotheecour: ?
09:38:08FromGitter<timotheecour> oh lol, nevermind, i misread :-) sorry!
09:38:45FromDiscord<Zed> has anybody tried getting audio input with nim? like with a microphone?
09:38:47leorizexmonader: line info please? :P
09:39:15leorize@Zed: I don't think we have a general purpose audio library
09:39:23leorizeI might be wrong though
09:39:54FromDiscord<Zed> There's a couple on nimble but they seem very unstable and unfinished
09:40:03FromGitter<xmonader> ... /home/xmonader/wspace/nim-servy/src/servy.nim(1045, 77) Error: type mismatch: got <proc (request: Request, response: Response): Future[system.bool]{.closure.}> but expected 'proc (request: Request, response: Response): Future[system.bool]{.gcsafe, locks: <unknown>.}' ⏎ I pushed my local changes https://github.com/xmonader/nim-servy/blob/master_ws_mem/src/servy.nim
09:40:26FromDiscord<flywind> sent a code paste, see http://ix.io/2mXW
09:40:35skrylar[m]audio library is .. well
09:40:45skrylar[m]playback or editing really
09:42:20leorize@xmonader: add `{.closure.}` to these: https://github.com/xmonader/nim-servy/blob/master_ws_mem/src/servy.nim#L410-L411
09:44:04*liblq-devel joined #nim
09:44:18*lqdev joined #nim
09:44:29*lqdev quit (Client Quit)
09:44:29*liblq-devel quit (Client Quit)
09:47:22FromGitter<xmonader> @leorize sadly the same error, it only starts when i remove the middlewares ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec79faab101510b200d99e7]
09:49:01FromGitter<xflywind> ```type MiddlewareFunc* = proc(req: Request, res: Response): Future[bool] {.closure, gcsafe.}```
09:52:04FromGitter<bung87> I may unify all db_* api so that I can introduce new bind proccess api..
09:53:01*couven92 joined #nim
09:53:08FromGitter<bung87> for now apis seems fine that sqlite have.
09:53:26*fredrikhr quit (Disconnected by services)
09:53:30*couven92 is now known as fredrikhr
10:01:52FromGitter<xmonader> @xflywind still the same ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec7a310778fad0b131c2350]
10:02:14FromGitter<xmonader> I even tried adding gcsafe to basicAuth, newStaticMiddleware functions too, but no good
10:02:48*couven92 joined #nim
10:06:42FromGitter<xflywind> Middlewares is seq of closure function. It can't accept nimcall function unless your first item is closure function.
10:07:40FromGitter<xmonader> @xflywind what!!? it worked btw
10:07:53FromGitter<xmonader> but .. what??
10:07:56alehander92thmm
10:07:59FromGitter<xflywind> [doNothingClosureMiddleware(), loggingMiddleware, , ...., ]
10:08:02FromDiscord<dom96> sounds like this could use a better error message
10:09:10FromGitter<xmonader> @xflywind i changed the order to one of the closure ones, but that's totally unexpected .. how would people even know that limitation?
10:09:46FromGitter<xflywind> @xmonader I don't know why, I just failed many times to get the right result. :-)
10:09:51FromGitter<xmonader> and the way i see it the whole nimcall, closure, locks, gcsafe is completely deceiving without good defaults too
10:10:02FromGitter<xmonader> > @xmonader I don't know why, I just failed many times to get the right result. :-) ⏎ ⏎ Hahahaha! thanks for doing the hard work!
10:10:31FromGitter<xflywind> np
10:10:39FromDiscord<dom96> Please report this as a bug, people shouldn't waste so much time diagnosing type mismatches like this
10:11:15FromGitter<xmonader> I will, creating a bug report already with the diffs too thanks
10:11:43FromGitter<xmonader> or post in the forum?
10:11:44FromDiscord<mratsim> closures and callbacks semcheck are super super annoying
10:11:45*konvertex joined #nim
10:12:20FromDiscord<mratsim> I hate having to put {.nimcall.}{.locks:0.} {.gcsafe.} and friends to please the Nim compiler
10:12:52FromDiscord<dom96> agreed
10:13:03FromDiscord<dom96> The rules should be fixed IMO
10:15:18*rockcavera joined #nim
10:19:02FromGitter<bung87> @leorize I'll take a break for this PR, though seems fine so far.
10:19:31skrylar[m]make a macro for {.mratcall.} :p
10:19:53*Vladar quit (Quit: Leaving)
10:23:19*a_b_m joined #nim
10:25:51*abm quit (Ping timeout: 260 seconds)
10:34:54*dddddd joined #nim
10:35:37FromGitter<xmonader> I opened a bug https://github.com/nim-lang/Nim/issues/14429 will reference it in the forum issue for concurrency/parallism too
10:39:03*narimiran quit (Quit: leaving)
10:42:43*brainbomb quit (Quit: Leaving.)
10:43:21Araqso... everybody happy with the dots?
10:44:39dom96the dots?
10:47:15solitudesfi just disabled the hint. before it was at least marginally useful, now its just noise.
11:00:41*vegai quit (Remote host closed the connection)
11:01:20alehander92which hint
11:01:53alehander92wow processing
11:04:02FromGitter<xmonader> very cool just did some websocket interaction over nim-servy with treeform/ws library :D
11:04:17alehander92wow this is new
11:04:21alehander92ok it sounds good
11:04:31alehander92but its a bit strange that i can still see CC: there
11:04:33alehander92by default
11:05:22alehander92also `verbosity:0` now still shows `...`
11:05:37alehander92which reminds me : i could've just used `verbosity:0` until now
11:15:01*tane joined #nim
11:37:41*endragor quit (Remote host closed the connection)
11:54:29*endragor joined #nim
12:01:23*fredg joined #nim
12:01:50FromDiscord<Yardanico> Yeah I like the dots but why they're only for Nim processing and not for CC as alehander mentioned?
12:06:01*supakeen quit (Quit: WeeChat 1.9.1)
12:06:07*Guest91926 quit (Ping timeout: 246 seconds)
12:06:41*supakeen joined #nim
12:07:38FromDiscord<dom96> can someone show an example of the dots?
12:13:02*dadada joined #nim
12:13:25*dadada is now known as Guest11303
12:13:57FromDiscord<Yardanico> https://camo.githubusercontent.com/3422d046a2f6474930674c078f6bd6ec5034c18f/68747470733a2f2f692e696d6775722e636f6d2f7665667a33336e2e706e67 from my message about a small bug (no newline)
12:16:05*opDispatch joined #nim
12:16:59opDispatchBTW related to a previous conversation, related to UFCS or dot operator, isn't it a problem when you have pipelines on several lines in NIM ?
12:17:17*waleee-cl joined #nim
12:17:24FromDiscord<Yardanico> It's not really a problem
12:19:00opDispatchyeah really stuff like https://dpaste.org/4hdF
12:19:38opDispatchyou can do it on several lines too ?
12:21:03FromDiscord<mratsim> @Araq can we have dinosaur game while waiting for compilation too? 😛
12:22:47FromDiscord<Yardanico> @opDispatch yes that works just fine
12:22:50FromDiscord<Yardanico> https://play.nim-lang.org/#ix=2mYu
12:23:36FromDiscord<Yardanico> And please don't call Nim "NIM", I'm really not sure why some people like to use it in uppercase
12:26:24opDispatchmmh that does not work
12:26:31Guest11303can custom pragmas be attached to templates, doesn't seem to work for me
12:26:48*Guest11303 is now known as dadada
12:27:10opDispatchthe "hi" is missing, which I find quite malpolite
12:27:17FromDiscord<Clyybber> Guest11303: No
12:27:24FromDiscord<Clyybber> But it might be lifted in the future
12:27:30dadadaopDispatch: hi
12:28:35dadadaopDispatch: I'm lurking here almost every day in the last time, so this makes it seem to me like I'm never really away from the chat, sorry, if that offends you
12:29:22dadadaClyybber: ah, I hope so, I want Nim's features to be consistent
12:30:10opDispatchok I think I've reached the bit
12:30:15opDispatchbot*
12:31:05opDispatchwell anyway I think that in the example the idea would be to concatenate
12:31:15opDispatchthis is not done obiously
12:32:59YardanicoopDispatch: ? it's quite easy
12:33:15Yardanicohttps://play.nim-lang.org/#ix=2mYx
12:33:27Yardanicoyou can check that it works on the playground just fine
12:34:27Yardanico"mmh that does not work" can you show a concrete example?
12:34:49opDispatchok got it to work bag of perverts https://play.nim-lang.org/#ix=2mYy
12:34:57Yardanico???
12:36:16opDispatchYardanico, the first example that was given to me didn't work at all
12:36:27Yardanico https://play.nim-lang.org/#ix=2mYu works just fine
12:36:50opDispatchno it just outputs "worl"
12:36:53Yardanicoso?
12:36:59opDispatch*"world"
12:37:03YardanicoI just showed that you can span dot operator over multiple lines
12:37:10Yardanicoif you check the proc definitions you can see that they don't concat
12:37:13Yardanicothey just return a new string
12:37:22Yardanicoit's just a simple exampl which is trivial to modify
12:38:46Yardanicoalthough it won't really be efficient
12:38:56Yardanicowell maybe it will be with arc, idk
12:39:53opDispatchthe point is that I asked about pipeline and the first answer I get was not a really pipeline, it just output the last pipeline result you see. But yeah I agree it was easy to make it better
12:40:08Yardanicowell I just showed that you can span . over multiple lines
12:41:25opDispatchbut that didn't show a frank relationship between each statement
12:41:37Yardanicowell it's really simple
12:41:44opDispatchbetween each line, rather
12:41:48Yardanicoa().b().c() b accepts the return value of a
12:41:51Yardanicoc accepts the return value of b
12:42:36opDispatchcant you just accept that your first example was bad goddmanit
12:43:00Yardanicono because it wasn't :P i mean it wasn't exactly what you asked for, but it perfectly showed how can you do multiline chaining of calls
12:44:24*audiofile joined #nim
12:44:50opDispatchalright
12:44:55*opDispatch left #nim ("Konversation terminated!")
12:45:02Yardanico:/
12:51:13*dadada quit (Ping timeout: 264 seconds)
12:52:55*dadada joined #nim
12:53:18*dadada is now known as Guest31184
12:59:56*xet7 quit (Remote host closed the connection)
13:02:02FromGitter<xmonader> websocket support in servy :) https://github.com/xmonader/nim-servy#websockets
13:05:58*xet7 joined #nim
13:07:19*D_ quit (Ping timeout: 244 seconds)
13:13:08*D_ joined #nim
13:13:55FromDiscord<Rika> jesus this op dude is rude 😛
13:15:41*Vladar joined #nim
13:15:58FromDiscord<Rika> i dont even know what the difference of his example and yard's
13:21:05*xet7 quit (Quit: Leaving)
13:22:54*dcmertens joined #nim
13:23:41dcmertensJust finished Chapter 3 of Nim in Action. It seems odd that there is no way to do non-blocking reads from stdin
13:23:49dcmertenscouldn't this be achieved with a select()?
13:24:01Yardanicodcmertens: it might be possible with https://nim-lang.org/docs/asyncfile.html nowadays
13:24:18dcmertensYardanico, thanks
13:24:19Yardanicoyou just do create AsyncFD(0) for stdin and read asynchronously I guess
13:25:46dcmertenscool. I'm glad to know about threaded programming, but it seemed odd that it was *required* for this
13:26:21Yardanicodon't worry, nim in action talks about threading later
13:35:50alehander92dcmertens i think its a property
13:35:56alehander92of many os-es overally
13:36:00alehander92i tried once
13:36:10*lain quit (Remote host closed the connection)
13:37:09dcmertensoh yeah, on Windows, select() only works on sockets, not on files
13:38:20alehander92and i read https://stackoverflow.com/questions/717572/how-do-you-do-non-blocking-console-i-o-on-linux-in-c
13:38:23alehander92so i used
13:38:36*lain joined #nim
13:38:49alehander92something from some status-im code and extracted it to a small module
13:39:21alehander92http://ix.io/2mYW
13:41:00alehander92this particular example might not make a lot of sense if one doesnt use nim-prompt
13:41:20alehander92and asynctools though
13:41:59alehander92but anyway, it should be somehow similar for one to use threads to read from stdin
13:42:41dcmertenscool. Thanks!
13:42:49alehander92and it it possible to write an abstraction which makes it easier
13:43:07alehander92but maybe one needs to add that to a cleaner lib solution
13:44:40alehander92reading more : it might be actually possible
13:45:07alehander92but obviously i am not an expert in this .. so just one needs to research more :D
13:49:20*brainbomb joined #nim
13:49:45*zacharycarter joined #nim
13:56:33*s4mu3lbk quit (Ping timeout: 258 seconds)
14:03:49*fredrikhr quit (Ping timeout: 264 seconds)
14:04:25*endragor quit (Remote host closed the connection)
14:04:31FromDiscord<mratsim> @dcmertens, it's not possible in any language, you need an extra thread that you can block
14:05:16FromDiscord<mratsim> it's not too hard to add, see https://github.com/mratsim/weave/issues/137
14:05:18disbotDedicated threadpool for blocking tasks
14:05:26*fredrikhr joined #nim
14:09:36FromDiscord<dom96> amazing how much the NimCopy's in JS can affect performance
14:09:49FromDiscord<dom96> Went from 4k ops/s to 800million ops/s
14:11:29FromDiscord<dom96> https://github.com/nim-lang/Nim/issues/14430
14:11:33disbotJS: Unnecessary NimCopy when assigning tuples ; snippet at 12https://play.nim-lang.org/#ix=2mZ2
14:18:52leorizeI suppose we need sink optimization in js land
14:19:00Yardanico@dom96 did you try with latest devel? just to make sure
14:19:07Yardanicothere was a PR which did some js improvements
14:20:21Yardanicohttps://github.com/nim-lang/Nim/pulls?q=is%3Apr+is%3Aclosed+author%3Ahlaaftana
14:20:36Yardanicohttps://github.com/nim-lang/Nim/pull/14158
14:20:38disbotmany bugfixes for js
14:21:47YardanicoI guess I can try myself
14:22:18leorizehttp://ix.io/2mZ5 <- not sure if this is a good sample
14:22:50FromDiscord<dom96> I can try later, but right now focused on other things
14:23:09FromDiscord<dom96> > http://ix.io/2mZ5 <- not sure if this is a good sample↵@leorize[IRC]#0000 yeah, that should work
14:23:42leorizethough I do think that tuple construction can be done better for these cases
14:24:37Yardanicowait did someone break js backend in devel
14:24:53Yardanicoor my local copy is broken :D
14:25:13Yardanicoah nvm had threads:on in a config
14:25:21leorizeYardanico: your bot also didn't manage to highlight me :P
14:25:28Yardanicowdym?
14:25:50leorizesee dom ping
14:26:03leorizeit uses discord notation
14:26:05Yardanicoyeah, but usually your IRC client should check if your nickname is in a substring
14:26:10Yardanicoleorize: well that's discord's feature
14:26:22YardanicoI mean I can try to replace that in the bot but still
14:26:40leorizeweechat limits the amount of context where highlight would be checked afaik :P
14:26:43Yardanicoleorize: your code generates this for JS btw - https://play.nim-lang.org/#ix=2mZ6
14:27:12Yardanicoon latest devel
14:27:12leorizeyea, just have to test on older nim :P
14:27:25Yardanicolemme try on 1.0.6
14:27:28leorizestill this is not too efficient
14:28:09leorizemaybe one day we will see optimization for these cases
14:32:26Yardanico@dom96 this is what I get for js backend on latestl devel (for geometry.nim) http://ix.io/2mZa/js
14:32:47Yardanicoah right need to check before your last commit
14:33:11FromDiscord<dom96> pretty sure you need to use that `intersect` otherwise it won't be compiled in
14:33:25Yardanicooh I thought you had tests for in in geometry.nim :P
14:33:29YardanicoI'll add some call now
14:33:32FromDiscord<dom96> I do for some
14:33:39FromDiscord<dom96> not this one I guess 😛
14:34:59Yardanicoyou do though :D
14:35:10alehander92dom96 wow yeah nim does a lot of nimCopy
14:35:19Yardanicoproc intersect*[T](line1, line2: LineSegment[T], epsilon = 0.001): bool = calls the one with var point
14:36:47Yardanicoah yeah it got compiled now
14:36:51Yardanicoand no there are no nimcopy in it :)
14:36:58Yardanicolemme show
14:37:16Yardanicohttps://play.nim-lang.org/#ix=2mZc
14:37:51FromDiscord<dom96> Cool, then we can close that issue
14:37:56FromDiscord<dom96> I should benchmark my game with devel it seems
14:38:13alehander92you even commented
14:38:15alehander92:D :D :D
14:38:16Yardanicowell your change still makes the codegen a bit better
14:38:20alehander92the PR
14:38:36Yardanico@dom96 after your commit - https://play.nim-lang.org/#ix=2mZd
14:38:43FromDiscord<dom96> true
14:38:45*theelous3_ quit (Quit: is outty)
14:38:55FromDiscord<dom96> it's a little crazy how slow nimcopy is
14:39:00FromDiscord<dom96> I wonder if there is space to optimise it
14:39:11alehander92isn't it just many repetitions of nimCopy
14:40:00FromDiscord<dom96> Don't think so
14:41:36Yardanico@dom96 one thing is that I had to add two more imports from lenientops to graphics.nim
14:41:38Yardanicofrom lenientops import `/`, `+`, `-`
14:42:34Yardanicoin simple.nim I had to dereference events before echoing them
14:43:05FromDiscord<dom96> looks like I will be chasing nimcopy for a while
14:43:19FromDiscord<dom96> https://media.discordapp.net/attachments/371759389889003532/713401611556356168/unknown.png
14:43:45leorizetry nim 1.2?
14:43:54FromDiscord<dom96> yeah, I will
14:45:25FromDiscord<dom96> Looks like I did eliminate that bottleneck at least though
14:45:40FromDiscord<dom96> collision detection no longer shows up in the profiler
14:45:49FromDiscord<dom96> it's just mostly eatCollidedParticles now
14:47:31FromDiscord<dom96> lol, those dots.
14:47:41Yardanico:D
14:48:01FromDiscord<dom96> next step: in-place replacement of the module that's currently being compiled?
14:48:08FromDiscord<dom96> with a emoji hourglass?
14:48:17Yardanicowhy not just use something like https://github.com/Yardanico/spinny/ then :D (my fork, the upstream still didn't merge the PR)
14:48:26alehander92wow good idea!
14:48:48alehander92very flashy :D
14:49:08Yardanico(and I made the fork because I was too annoyed by the fact that this lib used JSON for spinners definitions and parsed them at runtime)
14:49:54Yardanicoat least I found one more arc bug when working on it
14:50:10FromDiscord<dom96> 1231 vs 1031 NimCopy (1.0.6 vs. 1.3.5)
14:50:19Yardanicowhat about performance :D
14:50:54FromDiscord<dom96> https://media.discordapp.net/attachments/371759389889003532/713403523764584508/unknown.png
14:50:56FromDiscord<dom96> lol
14:51:00Yardanicolol
14:51:00FromDiscord<dom96> It generates broken JS
14:51:08Yardanicoa regression yay
14:51:22Yardanicomaybe due to https://github.com/nim-lang/Nim/pull/14158
14:51:24disbotmany bugfixes for js
14:51:30FromDiscord<dom96> My instinct to avoid devel has been proven right 😛
14:51:51leorizego 1.2 lol
14:52:02YardanicoI think it'll mostly have the same amount of NimCopy
14:52:04Yardanicoi can be wrong though
14:53:34FromDiscord<dom96> ugh, my choosenim is broken D:
14:54:48FromDiscord<dom96> https://media.discordapp.net/attachments/371759389889003532/713404502677651476/unknown.png
14:54:53FromDiscord<dom96> Greatest error ever
14:55:16Yardanicohmm
14:55:23Yardanicodid you rebuild nimble when going to devel?
14:55:41FromDiscord<dom96> nope
14:55:58FromDiscord<dom96> pretty annoying that shit like this can happen
14:56:09Yardanicothat error can be due to https://github.com/nim-lang/Nim/pull/14390 if you didn't update nimble I gues
14:56:10Yardanicos
14:56:11disbotfixes #14126 [backport:1.2]
14:56:13Yardaniconot exactly sure though
14:56:44FromDiscord<dom96> yay, I'm sure many will run into this
14:57:00disruptek~stream
14:57:00disbotstream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek
14:57:09disruptekreturning to async i/o on linux.
14:58:58alehander92oii
15:00:22FromDiscord<dom96> https://media.discordapp.net/attachments/371759389889003532/713405903235448913/unknown.png
15:00:23FromDiscord<dom96> really?
15:00:33FromDiscord<dom96> choosenim now depends on `make`?
15:01:29Yardaniconimterop be like
15:01:36Yardanicowell it's compiling bzip2
15:03:52FromDiscord<dom96> No Nim package should depend on `make`
15:04:01FromDiscord<dom96> This goes against the whole philosophy of Nim
15:04:13Yardanico4raq wasn't happy with nimterop either ;P
15:04:17Yardanicoisn't*
15:04:29FromDiscord<dom96> I know
15:04:45shashlickWhat's the problem with make
15:04:54FromDiscord<dom96> The problem is I don't have it
15:04:57FromDiscord<dom96> and I don't want to install it
15:05:07FromDiscord<dom96> I just want to quickly get into choosenim and fix a bug
15:05:16FromDiscord<dom96> But now I have to deal with dozens of dependencies
15:08:47FromDiscord<dom96> I gave it a try
15:08:55FromDiscord<dom96> https://media.discordapp.net/attachments/371759389889003532/713408058931281920/unknown.png
15:09:12FromDiscord<dom96> maybe the `make` I downloaded is wrong
15:15:47FromDiscord<dom96> shashlick: any ideas?
15:16:05shashlickYou just need make
15:16:28shashlickOr you can install bzip2 with headers
15:16:28FromDiscord<dom96> yes, I downloaded http://gnuwin32.sourceforge.net/packages/make.htm and it gave me that error
15:17:03shashlickYou on windows?
15:17:07FromDiscord<dom96> yes
15:17:19shashlickWith mingw? Doesn't that come with make?
15:17:47FromDiscord<dom96> doesn't look like it
15:18:05FromDiscord<dom96> I'm looking in ~\.choosenim\toolchains\mingw64\bin and it's not there
15:18:42shashlickThere should be a mingw32-make which should get used instead
15:19:17FromDiscord<dom96> yeah, it's there
15:19:36FromDiscord<dom96> it doesn't get added to path by choosenim
15:19:38shashlickAfter downloading make like you did and added to path, did it give a different error?
15:20:10FromDiscord<dom96> https://media.discordapp.net/attachments/371759389889003532/713410887888928788/unknown.png
15:20:17FromDiscord<dom96> that's with mingw32-make
15:22:08shashlicktimothee reported that too
15:22:24shashlickI need to see how to reproduce it
15:22:37shashlickI cannot so far
15:22:56FromDiscord<dom96> Unfortunately this is the risk with dependencies
15:23:06shashlickEven last night I got it working across a large matrix
15:23:15shashlickLarger than our CI
15:23:25FromDiscord<dom96> The more you've got the higher the chance of problems for people with different configurations
15:23:29shashlickWell you cannot be independent either
15:26:10shashlickSo the bzip2 makefile sets CC=cc
15:26:24shashlickSo seeing CC=gcc should fix that
15:26:29shashlickBut I've never had to do it
15:26:49shashlickDoes cc.exe not exist or not in the path again?
15:27:02shashlickThis might explain the variability
15:28:30FromDiscord<dom96> Anyway, I was able to diagnose the problem I had: https://github.com/dom96/choosenim/issues/199
15:28:33disbotNimarchive cannot overwrite existing extraction? ; snippet at 12https://play.nim-lang.org/#ix=2mZw
15:29:24FromDiscord<dom96> which tbh in this scenario I wouldn't want choosenim to overwrite these DLLs
15:30:49*dddddd quit (Ping timeout: 264 seconds)
15:30:58FromDiscord<dom96> crazy how just me renaming a DLL caused choosenim to break
15:31:33dcmertenshahaha
15:31:42dcmertensyou renamed a DLL and expected things to work??
15:33:41FromDiscord<dom96> Umm. It's not a DLL that choosenim depends on at runtime
15:33:58dcmertens:-)
15:34:03dcmertensI'm just giving you a hard time
15:34:06*WasmAddict joined #nim
15:34:27FromDiscord<dom96> Anyway, 1.2.0 actually regresses my game to 4fps in Firefox
15:34:28FromDiscord<dom96> fun
15:34:51WasmAddictHey all, has there been any updates in the support of web assembly? I always find myself searching around on google about nim and wasm support and end up in vague echoes of people talking about it on the internet.
15:35:45FromDiscord<dom96> I did an experiment and concluded that WebAsm is a waste of time
15:35:55FromDiscord<dom96> Nim's JS backend is all you need
15:36:11WasmAddictWaste of time for "what"?
15:36:17WasmAddictFYI, i'm not talking about emscripten, just basic wasm
15:36:27*dcmertens notes the name of the person who is talking
15:37:15FromDiscord<dom96> Why do you want wasm support in Nim?
15:37:48WasmAddictSo I can do incredibly fast math in a web browser using Nim
15:38:20FromDiscord<dom96> have you benchmarked webasm vs js for the math you want to do?
15:38:31WasmAddictyou do realize webasm is dead, yes?
15:39:10FromDiscord<dom96> Hrm?
15:39:18WasmAddictsorry, my brain read that as asm.js
15:39:37WasmAddictI feel like you are attacking my potential use case
15:39:50WasmAddictYes, I can imagine a use case javascript sucks at math compared to web assembly
15:40:17WasmAddictI'll go with ... i'm writing a zip library
15:40:37shashlickdom96 - why is it doing the dlls again - it should be checking for the condition
15:40:53FromDiscord<dom96> shashlick: because it checks whether all DLLs are there
15:40:55shashlickdom96 - was i right about the bzip2 thing
15:41:10FromDiscord<dom96> shashlick: I gave up trying to fix it
15:41:33shashlickokay i'll experiment with a choosenim specific mingw - i always use the global install
15:41:55*WasmAddict quit (Remote host closed the connection)
15:41:56shashlickare you good with the two open PRs? i'll fix these two
15:42:13Yardanicosad that WasmAddict left
15:42:20YardanicoI wanted to say that you can already use clang's wasm-32 backend with nim
15:46:01FromDiscord<dom96> hm, can't repro the slowdown from 1.2.0 now
15:46:12FromDiscord<dom96> In any case, not seeing significant speed up.
15:46:28FromDiscord<dom96> at least it works though
15:46:58shashlickdom96: are you good with the two open choosenim PRs
15:47:09FromDiscord<dom96> What do you mean?
15:47:15FromDiscord<dom96> Why wouldn't I be?
15:47:22shashlickcan we merge then :D
15:47:40FromDiscord<dom96> oh, you mean do I like the two PRs that are there
15:47:45FromDiscord<dom96> I haven't reviewed them I guess
15:47:54shashlickvery small, should take 2 minutes
15:54:46FromDiscord<dom96> done
15:56:29shashlickCool, will fix the other two issues
15:59:24*s4mu3lbk joined #nim
16:06:28FromDiscord<IanIAnIAN> About the conference; is there a list of talks we can expect to see ?
16:08:19Yardanicowell it will be there, yes
16:08:22Yardanicosubmission deadline is 31th
16:08:28Yardanicoof May
16:09:19FromDiscord<IanIAnIAN> 31st of May 🙂 he told the bot
16:18:59dcmertensRather than simply ask, I decided to try to test nim's capacity for closures
16:19:06dcmertensAlas, I am running into compiler errors
16:19:31dcmertensI am trying to return a tuple of three procedures that take void an return ints
16:19:52Yardanicodcmertens: "take void" that's not really a thing
16:19:53dcmertensthen I am attempting to construct each anonymous function and store it in a variable
16:20:00Yardanicoor you mean proc (): int
16:20:07dcmertens^^ yes
16:20:17Yardanicocan you show ,more code please? :)
16:20:42dcmertenssure. Is there a preferred paste bin?
16:20:58Yardanicoplay.nim-lang.org
16:21:03leorize~playground
16:21:04disbotplayground: 11an online in-the-browser IDE for simple Nim experiments at http://argentina-ni.ml/
16:21:04disbotplayground: 11https://play.nim-lang.org the official Nim playground, can run Nim in the browser and share snippets
16:21:05Yardanico(it uses ix.io for pastes)
16:21:58dcmertenshttps://play.nim-lang.org/#ix=2mZT
16:22:25Yardanicowell, I think sugar doesn't support void really
16:22:36dcmertenshaha, well that wouldn't help, then
16:22:42Yardanicodcmertens: but your code can work
16:22:53dcmertenscool
16:23:32Yardanicolemme see
16:24:52Yardanicoand I don't think you can capture var arguments in closures anyway
16:25:08*brainbomb quit (Quit: Leaving.)
16:25:16leorizeyea you can't atm
16:25:26leorizeonce analysis gets better it will be safer to do so
16:25:28dcmertensAnd here is the error stating as much: "'i' is of type <var int> which cannot be captured as it would violate memory safety"
16:25:31Yardanicoyep
16:25:35Yardanicoyou can't capture var arguments in closures
16:26:00dcmertensok, I was just being lazy
16:26:45dcmertensHere's the revised version, and it works: https://play.nim-lang.org/#ix=2mZW
16:27:27dcmertenswell, apart from the spurious variables v1 and v2
16:27:46dcmertensHow does nim do this? Does it use a trampoline provided by FFI?
16:28:07dcmertensThat is, would the closures be valid for passing to a C function that wants a function pointer?
16:28:22Yardanicoclosure is a function with a hidden env pointer
16:28:33dcmertensput differently, how do I view the C code this produces?
16:28:44*dcmertens looks up nim -h
16:29:18Yardanicodcmertens: on *nix it's in ~/.cache/nim/filename_(d|r)/files
16:29:25Yardanicod for debug r for release (-d:release or -d:danger)
16:29:36YardanicoI wouldn't recommend you to read C code without compiling with -d:danger :)
16:29:54dcmertensthanks
16:29:57leorizeuse --nimcache and specify the location yourself
16:30:04*liblq-dev quit (Ping timeout: 272 seconds)
16:30:05leorizebetter than digging the system temp folder
16:30:47Yardanico well ~/.cache/nim is in user's home folder :)
16:35:46*Guest31184 quit (Ping timeout: 272 seconds)
16:36:39FromGitter<bung87> cant't call macro from template?
16:36:51Yardanicoyou can, depends on what you mean by "call"
16:37:22FromGitter<bung87> the editor hint :`undeclared identifier:`
16:39:05Yardanicowell if you "call" a macro from a template in one module
16:39:10Yardanicoand then call a template from another
16:39:16Yardanicothen you need to bind the macro in the template
16:39:20Yardanicolike "bind macroName"
16:39:26Yardanicoin the template
16:39:39Yardanicohttps://nim-lang.org/docs/manual.html#generics-bind-statement
16:40:18*fredrikhr quit (Quit: Client Disconnecting)
16:40:25FromGitter<bung87> same..
16:40:30Yardanicoshow more code please?
16:40:51FromGitter<bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ec800924c9b0f060d19150d]
16:41:13FromGitter<bung87> other thing is I may not able call it under if statement.
16:41:18Yardanicowhy did you make it a template though?
16:41:36FromGitter<bung87> simple to write : (
16:42:08*dadada joined #nim
16:42:31*dadada is now known as Guest43983
16:42:59FromGitter<bung87> ok I change to macro
16:45:16*couven92 quit (Read error: Connection reset by peer)
16:45:17leorizeyou don't really need to do the `if`
16:45:22*fredrikhr joined #nim
16:45:27leorizefor the args length check
16:45:29Yardanicoah lol I didn't see yeah
16:45:36Yardanico@bung87 templates are just code substitution
16:46:02leorizeyou might want to store the SqlPrepared in a temporary variable though
16:46:11*couven92 joined #nim
16:46:21Yardanicooh yeah, double evaluation
16:49:49*fredrikhr quit (Ping timeout: 258 seconds)
16:50:08*onionhammer quit (Quit: WeeChat 2.6)
16:50:29*onionhammer joined #nim
16:52:48*waleee-cl quit (Quit: Connection closed for inactivity)
16:57:11*audiofile quit (Quit: Going offline, see ya! (www.adiirc.com))
16:59:49FromGitter<bung87> hmm, I need rewrite my previouse merged PR..
17:06:04*liblq-dev joined #nim
17:06:06*Guest43983 quit (Ping timeout: 260 seconds)
17:06:27*couven92 quit (Ping timeout: 272 seconds)
17:12:02FromGitter<bung87> evaluated by compiler ?
17:12:13*dadada__ joined #nim
17:21:49*MightyJoe joined #nim
17:23:13*cyraxjoe quit (Ping timeout: 246 seconds)
17:33:23*NimBot joined #nim
17:34:06*dcmertens quit (Quit: Leaving)
17:35:48*dadada__ quit (Ping timeout: 256 seconds)
17:39:54*fredg quit (Ping timeout: 240 seconds)
17:42:21*dadada joined #nim
17:42:44*dadada is now known as Guest41291
17:45:48*fredg joined #nim
17:56:53*Guest38566 quit (Quit: leaving)
17:57:02*WilhelmVonWeiner joined #nim
18:02:30*MightyJoe quit (Ping timeout: 256 seconds)
18:26:47FromDiscord<Yardanico> @bung87 templates are code substitution
18:27:43FromDiscord<Yardanico> If you have a template which uses an argument "test" passes to it twice, and call that template like mytempl(fun(3)) then proc "fun" will be called twice
18:29:10FromDiscord<FromIRC> Uptime - 1 day, 22 hours, 53 minutes, 9 seconds, 54 milliseconds, 563 microseconds, and 820 nanoseconds
18:29:11FromDiscord<Yardanico> !status
18:31:03FromDiscord<Yardanico> https://play.nim-lang.org/#ix=2n0T @bung87
18:41:22FromGitter<bung87> @Yardanico ah , I see
18:42:08FromGitter<bung87> just wondering why says " double evaluation"
18:42:35FromGitter<bung87> it's just a pointer
18:57:28FromDiscord<Yardanico> Well someone might create a procedure to return that pointer
18:57:38FromDiscord<Yardanico> And modify it or something
18:57:42*zacharycarter quit (Remote host closed the connection)
18:57:54FromDiscord<Yardanico> So to be safe it's better to use a variable so it's evaluated one
18:57:55FromDiscord<Yardanico> Once*
18:58:05FromGitter<fowlmouth> when the template is evaluated its just like inlining the code so in the example, data is not the result of calling tt(), it is the literal expression tt()
18:59:53FromDiscord<Recruit_main707> could a dll check wether anotehr dll should be reloaded?
19:09:59*dddddd joined #nim
19:10:16FromGitter<bung87> I understand how template works, just not know why store a pointer
19:12:36FromGitter<bung87> std lib `{.experimental: "codeReordering".}` accept? otherwise would move bunch of code...
19:14:04FromGitter<bung87> in js store a ref so that will not trigger hunt prototype chain. in Nim I dont know
19:17:36*konvertex quit (Quit: quit)
19:19:53leorizebung87: templates parameters are substituted in
19:21:59leorizemeaning that an expression like: `db.exec(thisExpensiveCall(), params)` will have `thisExpensiveCall()` substituted into all instances of `ps` in the template
19:24:40FromGitter<bung87> that's about the result code generated ?
19:25:45*Guest41291 quit (Ping timeout: 256 seconds)
19:26:43*dadada joined #nim
19:27:06*dadada is now known as Guest79222
19:29:42FromGitter<bung87> in the ast tree `thisExpensiveCall ` is just a symbol
19:34:09*lritter joined #nim
19:41:58FromGitter<bung87> I can image this case ⏎ ⏎ ```template tpl1(): ⏎ for loop:``` [https://gitter.im/nim-lang/Nim?at=5ec82b067da67d06fac5ea68]
19:42:15FromGitter<bung87> ` tpl2()`
19:43:20FromGitter<bung87> this may fit the case described upon
19:46:29FromGitter<bung87> found template in template not code reorder well.
19:58:15*waleee-cl joined #nim
19:58:39*brainbomb joined #nim
19:59:23FromDiscord<Recruit_main707> lmao, i just passed a python complex Structure to my nim function, which expects a nim Object, (of the same characteristics) and it worked out of the box, it was so impressive
20:10:04alehander92bung87 i am not sure
20:10:09alehander92this would be accepted in stdlib
20:11:21alehander92otherwise
20:11:25alehander92the issue is very subtle
20:11:51alehander92imagine your template generates `echo arg ... b = arg`
20:12:12alehander92and you call `tmpl(download())`
20:12:18alehander92the final code is
20:12:23alehander92echo download() .. b = download()
20:12:32alehander92bam , two downloads
20:12:51*zacharycarter joined #nim
20:12:55alehander92actually not too obvious and very important to prevent
20:15:59*brainbomb quit (Quit: Leaving.)
20:16:52FromDiscord<Yardanico> @Recruit_main707 that's nice but it might not work sometimes :)
20:16:55FromDiscord<Yardanico> Stuff like alignment
20:17:55FromDiscord<Recruit_main707> sometimes as in, otehr situatons? or sometimes as in, run it twice and get different results?
20:19:38Yardanicosometimes as in - different interpreter version, different bitness of the computer, etc :)
20:19:51FromDiscord<Recruit_main707> fine for me :)
20:22:04livcdi just want to say nim is really cool
20:22:39Yardanicogithub server errors AAAAaaa
20:22:43zacharycarterin C - does `*dst++` mean dereference `dst` and then increment the pointer?
20:22:53zacharycarteror increment the derferenced value?
20:23:10Yardanicohttps://stackoverflow.com/questions/859770/post-increment-on-a-dereferenced-pointer might help
20:23:31Yardanicohttps://stackoverflow.com/a/860053/5476128
20:23:31Zevvhaha
20:23:35zacharycarterah okay so it's the former
20:23:36zacharycarterthanks
20:23:45zacharycarterthat's what I figured but wanted to make sure
20:24:07alehander92i think its better to not use it
20:24:12alehander92yourself if possible
20:24:23zacharycarterI'm not - just reading imgui source code
20:24:32zacharycarterhope everyone is ready for nimgui :)
20:24:54Yardanicowell we already have bindings for cimgui, you are making bindings for imgui directly?
20:24:54Zevvit's pretty idiomatic
20:25:02zacharycarterno I'm porting imgui to nim
20:25:04*s4mu3lbk quit (Read error: Connection reset by peer)
20:25:05Yardanicooh lol
20:25:15FromDiscord<Recruit_main707> respect +
20:25:49zacharycarterI think I almost have window rendering working
20:25:51zacharycarterhopefully by the end of today
20:25:54*s4mu3lbk joined #nim
20:26:02FromDiscord<Recruit_main707> thats cool
20:26:40FromGitter<bung87> @alehander92 I got it
20:27:10zacharycarterhopefully by the end of today
20:27:15zacharycarterwhoops sorry
20:27:33*Vladar quit (Quit: Leaving)
20:28:49FromGitter<bung87> the param could be a call expression, when pass it to template , its like a call expression NimNode.
20:29:03Yardanicoyes, as people said (me too), templates are just code substitution
20:29:57FromGitter<bung87> ah, I aways need read doc when deal with template macros...
20:30:21Yardaniconim templates are a bit similar to C macros, but are still more powerful :)
20:30:44FromGitter<bung87> I hope theres doc describe the hidden details.
20:31:07Yardanicohttps://nim-lang.org/docs/manual.html#templates
20:31:51FromGitter<bung87> I mean manual describe it seperately
20:32:23Yardanicowell the manual tells you that ": It is a simple substitution mechanism that operates on Nim's abstract syntax trees."
20:32:23FromGitter<bung87> templates, macros, compile time proc, typed,untyped, NimNode
20:33:00FromGitter<bung87> what's the relationship between these.
20:33:00Yardanicothey're all in the manual
20:33:08Yardanicowell wdym "relationship"
20:33:21Yardanicotemplates are macros are separate features
20:33:27Yardanicocompiletime is a pragma which is different too
20:33:43*nsf joined #nim
20:34:31Yardanicotyped/untyped - https://nim-lang.org/docs/manual.html#templates-typed-vs-untyped-parameters
20:34:59Yardanico"untyped" allows you to pass **any** valid nim syntax even if it has undeclared variables, procedures, etc
20:35:19Yardanico"typed" only allows you to pass stuff which is actually a semantically valid nim code which was already checked by the compiler for all different kinds of errors
20:37:19FromGitter<bung87> simple question , when a variable become a NimNode?
20:38:01Yardanicountyped/typed become NimNode in macros
20:38:09Yardanicoor if you have a compiletime proc which EXPLICITLY accepts a "NimNode"
20:38:19Yardanicolike proc a (data: NimNode) =
20:38:49FromGitter<bung87> I know typed that the compiler parse it as individual variable, untyped could be a bunch of code.
20:39:11Yardaniconot neccesarily
20:40:08FromGitter<bung87> "untyped/typed become NimNode in macros" what about in template
20:40:18Yardanicotemplates don't operate on NimNode
20:40:23Yardanicothey are just simple code substitution
20:41:38Yardanico@bung87 about typed - https://play.nim-lang.org/#ix=2n1K
20:41:43Yardanicothat code is perfectly valid
20:42:04FromGitter<bung87> ok , one more question :P , ast tree node and NimNode what's relationship?
20:42:37Yardanicowhat is " ast tree node" ?
20:42:50FromDiscord<Elegant Beef> Do you just mean a branch on the ast?
20:43:13FromDiscord<Elegant Beef> NimNode is just the base AST node that has object variants for each node kind
20:43:24Yardanicoyeah
20:43:29Yardanicoall AST nodes are NimNode
20:43:42FromDiscord<Elegant Beef> Kind/value is the only difference
20:43:54FromDiscord<Elegant Beef> And im glad i did macro stuff so i can say this with certainty!
20:44:14FromDiscord<Elegant Beef> "Beef is not as much a numpty" should be my new name
20:44:39FromDiscord<Elegant Beef> If you're writting macros become great friends with dumpTree
20:44:42Yardanicohttps://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim#L723 for the compiler representation
20:44:46Yardanico@Elegant there's also treeRepr
20:44:47YardanicoastGenRepr
20:44:48YardanicolispRepr
20:44:56Zevvand just repr!
20:44:58FromGitter<bung87> the example intersting
20:44:58FromDiscord<Elegant Beef> eh i use treeRepr and dumpTree
20:45:31FromGitter<bung87> thought untyped should be second param.
20:46:00Yardanicowhy?
20:46:05Yardanicocode is typed since it has a return value
20:46:08Yardanicoit's a statement list expression
20:46:19Yardanicohttps://nim-lang.org/docs/manual.html#statements-and-expressions-statement-list-expression
20:46:22FromDiscord<Elegant Beef> I've got this nice template with mratsim's help for adding levels to a LUT↵https://play.nim-lang.org/#ix=2n1M
20:46:52FromDiscord<Elegant Beef> Templates/macros are awesome, although typed versions behave weird
20:47:26Yardanicoalso the difference between typed/untyped is that with untyped you will just get idents
20:47:27Yardaniconot symbols
20:47:41*audiofile joined #nim
20:47:42Yardanicobut with "typed" you get symbols and can get their types definitions and stuff
20:48:18FromGitter<bung87> `test(hello,2):`
20:48:49Yardanicothat's 3 arguments
20:48:54FromGitter<bung87> hello and 2 will into the first param
20:49:16Yardanicoyes
20:49:22Yardanicoyou can avoid that by checking if "name" is a single node
20:49:25Yardanicoor something like that
20:50:00FromGitter<bung87> ok, learned new thing
20:50:19Yardanicoanyway most of this can be found in the manual (which contains a lot of info people ask about) and macros docs
20:52:05shashlick@zacharycarter what motivated you to port imgui
20:53:14shashlickWhy not make better bindings instead
20:54:57FromGitter<bung87> when you say ident , it might be just get name information?
20:55:09Yardanicoident is just node with a string for the name
20:55:13Yardanicoit's not attached to any type
20:55:32YardanicoI mean you can try to get the type with things like parseExpr and stuff
20:55:42*martinium joined #nim
20:55:54FromGitter<bung87> ok, very clear explaination.
21:09:34*s4mu3lbk quit (Quit: Leaving)
21:09:57alehander92this is true
21:09:59alehander92but you can actually gener
21:10:10alehander92new code which then checks the type itself with `when`
21:10:17alehander92or using a typed macro or overload
21:10:22alehander92its a hack but its also possible
21:10:35alehander92if you somehow need to start with untyped
21:14:36FromGitter<bung87> ok :P
21:30:09FromGitter<bung87> i got error when bindSym to a iterator
21:34:45*smitop joined #nim
21:35:53*neceve quit (Ping timeout: 260 seconds)
21:44:04*inv2004 joined #nim
21:44:40inv2004Hello, Are there anything like "default generic" ? I would like to define something like iterator items[T=K](x: K): T
21:45:24inv2004to be able to call "for x in k:" and "for x in k.items[:int]:"
21:46:35zacharycarterwhoops sorr
21:46:59Yardanicoinv2004: just define another non-generic proc I guess?
21:47:11Yardanicowell I mean iterator
21:47:33*a_b_m quit (Remote host closed the connection)
21:47:38inv2004@Yardanico, overloaded 'items' leads to ambiguous calls
21:48:20FromGitter<bung87> hmm. I finally make code no warning in editor..
21:48:25FromGitter<bung87> but got ` Error: internal error: proc has no result symbol`
21:49:00FromGitter<bung87> can't return callIlterator() in macro?
21:49:05Yardanico?
21:50:09FromGitter<bung87> ```nnkCall.newTree( ⏎ fastRows, ⏎ dbBind, ⏎ preparedStatement ⏎ )``` [https://gitter.im/nim-lang/Nim?at=5ec849102c49c45f5a973f75]
21:51:08FromGitter<bung87> the last line I call a iterator in macro
21:51:21Yardanicouhh
21:51:26Yardanicoyou can't just "call" an iterator
21:51:32Yardanicoyou need to have it in a for loop for example
21:52:35FromGitter<bung87> ah, let me think how to handle this.
21:55:19FromGitter<bung87> I guess I need read https://nim-lang.org/docs/manual.html#macros-for-loop-macro
21:55:35Yardanicoif you want to CREATE a macro iterator for a for loop - yes
21:55:40Yardanicoif you want to make a for loop in your own macro - no
21:56:09inv2004@Yardanico, https://play.nim-lang.org/#ix=2n27
21:56:28Yardanicoinv2004: well one alternative would be to use typedesc instead of generics
21:58:36Yardanicoe.g. https://play.nim-lang.org/#ix=2n28
21:59:38Yardanicomaybe there's a better way, I don't know, I don't use generics very often :)
22:00:05inv2004@Yardanico, thx, I just completed reading first page about typedesc
22:00:49inv2004ah, it not not normal generic :(
22:00:59Yardanicowdym?
22:01:13inv2004it is in argument also
22:01:19Yardanicoyes but it's compile-time only
22:01:23Yardanicotypedesc doesn't exist at runtime
22:01:34Yardanico"These values exists only during the compilation phase, but since all values must have a type, typedesc is considered their special type."
22:01:51inv2004Yep, it is clear, I thank you for your solution
22:01:52Yardanicoand nim iterators are always inlined anyway
22:01:59Yardanico(except if it's a closure iterator of course)
22:02:01FromGitter<bung87> the example doest show that can yield
22:02:13Yardanico@bung87 ?
22:02:20inv2004the only thing that it is not .items[:string]
22:02:24Yardanicowell yes
22:02:30FromGitter<bung87> the doc https://nim-lang.org/docs/manual.html#macros-for-loop-macro
22:02:44Yardanico@bung87 you're looking at the _wrong_ place
22:03:03Yardanicoif you want to create an NimNode which will then be a for loop - you need to construct an ast
22:03:05*audiofile quit (Quit: Going offline, see ya! (www.adiirc.com))
22:03:16Yardanicotry astGenRepr on the input of your macro to see how a for loop would look
22:03:37Yardanicoinv2004: I might know the alternative, lemme try
22:04:15Yardanicoah nvm
22:04:38inv2004ok, thx anyway - will apply your solution in the library
22:05:06inv2004But if you find solution, for example during sleep - ping me in telegram :)
22:07:34FromGitter<bung87> but it's iterator, I can just using for loop, can I consider they are same performance?
22:08:37FromGitter<bung87> it will be used as `for xx in myMacro:`
22:09:00FromGitter<bung87> `myMacro (a,b,c)`
22:09:05Yardanicooh, well you might try
22:09:15Yardanicobut generally it's not ok to use experimental features in the stdlib
22:09:16Yardanicoreally not ok
22:09:31Yardanicowell I guess it wouldn't hurt
22:10:15FromGitter<bung87> em .. fighting hours just modify hundred lines... so sad
22:11:06inv2004bung87, try rust - you will fight month with 20 lines sometimes :)
22:11:12FromGitter<bung87> I'll just try , might not be able commit in to my PR
22:11:38FromGitter<bung87> oh, that's heard even so sad..
22:11:51*brainbomb joined #nim
22:12:06*abm joined #nim
22:13:34FromDiscord<speckledlemon> How is documentation automatically generated for packages?
22:13:40Yardanicoit uses docstrings
22:13:47Yardanicodoc comments*
22:13:49Yardanico# is a normal comment
22:13:52Yardanico## is a documentation comment
22:14:05Yardanicohttps://nim-lang.org/docs/manual.html#lexical-analysis-comments
22:14:10Yardanico"Documentation comments are comments that start with two ##. Documentation comments are tokens; they are only allowed at certain places in the input file as they belong to the syntax tree!"
22:14:10FromDiscord<Elegant Beef> and multiline can be done the same way as comments just with two #
22:14:19FromDiscord<speckledlemon> Right, but what tool do I use for the generation?
22:14:23FromDiscord<Elegant Beef> nim doc
22:14:23Yardanico"nim doc"
22:14:43Yardaniconim doc suports RST and a subset of markdown for code formatting
22:14:58Yardanicofor (relatively) simple example check https://github.com/Yardanico/nim-mathexpr/blob/master/src/mathexpr.nim :)
22:14:59FromDiscord<speckledlemon> For each file individually?
22:15:40Yardanicohttps://nim-lang.org/docs/docgen.html
22:15:46Yardanicoyou can use "nim doc --project" for the whole project
22:15:53Yardanicobut read that page :)
22:20:49FromDiscord<speckledlemon> mmmm nice output. wish some of this was discoverable under `nim --help`
22:22:34*Guest79222 quit (Ping timeout: 265 seconds)
22:22:46Yardanicotried --fullhelp ? :)
22:22:51FromDiscord<speckledlemon> and it's choking on a backtick somewhere with a line number that doesn't make sense
22:22:59Yardanicowhy?
22:23:10FromDiscord<speckledlemon> welp forgot about that one
22:24:10FromDiscord<speckledlemon> the line number is way before any backtick, but it goes away when I remove all the backticks
22:26:11*liblq-dev quit (Quit: WeeChat 2.8)
22:26:48*brainbomb quit (Quit: Leaving.)
22:27:11*fredg quit (Quit: Lost terminal)
22:28:10skrylar[m]araq may finally get his immgui of sorts
22:28:16Yardanicolel
22:28:50skrylar[m]if it weren't for this insomnia i would have done the earcut tesselator today
22:31:28FromDiscord<speckledlemon> Oh, it’s RST, not Markdown :facepalm:
22:31:36Yardanicoyes
22:31:45Yardanicoas I said, it's RST and a bit of markdown
22:33:20skrylar[m]i also made a silly script that makes asciidoc from nim modules by ripping the #- lines
22:33:44*nsf quit (Quit: WeeChat 2.8)
22:38:20*inv2004 quit (Quit: Leaving)
22:42:10FromGitter<bung87> when I use `varargs[untyped]` should check if one is not `nnkBracket` ?
22:42:41FromGitter<bung87> seems only this could valid compile but cause runtime error
22:44:29FromGitter<bung87> I also want check it's when args.len == 0 , but pass `[]` will not make it true
22:48:54*solitudesf quit (Ping timeout: 240 seconds)
22:57:39FromDiscord<Recruit_main707> Can you convert an ptr Uncheckedarray[T] to a seq[T] somehow?
22:58:57Yardanicoby copying
22:59:41Yardanicovar s = newSeq[int](lenOfArray); for i in 0 ..< lenOfArray: myseq[i] = array[i]
23:01:15FromDiscord<Recruit_main707> Can you access the len of an Uncheckedarray?
23:01:27FromDiscord<Recruit_main707> Or that would need to be managed separately
23:01:49Yardanicoyou need to get the length from somewhere else
23:01:58Yardanicousually from the C side if you interface with C libs
23:02:17FromDiscord<Generic> an UncheckArray has no length
23:02:19FromDiscord<Recruit_main707> That's easy I guess
23:02:39FromDiscord<Generic> it's just an address you can make relative accesses from
23:05:01FromDiscord<Recruit_main707> And, what would be a better practice:↵Having an unpopulated array of 64 (maximum yet really uncommon) complex objects? Or having a seq of them despite the number of them being the same for the whole execution time?
23:05:23Yardanicoarray of course
23:05:27FromDiscord<Recruit_main707> A partially unpopulated*
23:05:57FromDiscord<Generic> it depends if it's possible that not all of them are going to be used then a seq
23:05:57Yardanicohow complex we're talking about?
23:06:02FromDiscord<Generic> but otherwise an array
23:06:08FromDiscord<Recruit_main707> They are approximately objects of 12 floats approx
23:06:18FromDiscord<Recruit_main707> +-
23:06:42Yardanicothat's not that much
23:06:48Yardanico6kb
23:06:49FromDiscord<Generic> that's really not much
23:06:51Yardanicoyeah go with an array
23:06:55FromDiscord<Recruit_main707> K
23:06:59Yardanicoit's only ~6kb on 64-bit
23:07:08FromDiscord<Recruit_main707> That simplifies the problem :)
23:07:40*tane quit (Quit: Leaving)
23:10:25Yardanicotfw js devs are talking "look my webpage now uses 1mb less download" and nim devs are talking "omg what do I do i have a 6kb variable it's too much !11"
23:10:33Yardanico /s
23:10:52zacharycarterweb dev is cancer
23:12:15PrestigeI agree
23:12:17zacharycartermy boss was asking today why our AWS costs doubled since March
23:12:29zacharycarterand all I could say was - this is what happens when you throw more hardware at inefficient software
23:12:50zacharycarterand then, like most managers, he talked about his glory days as a developer
23:23:36FromDiscord<exelotl> https://media.discordapp.net/attachments/251865928311111691/713428034329378856/received_2606328639622941.png
23:24:07zacharycarter:D
23:25:43FromGitter<bung87> does varargs can get len?
23:26:20FromDiscord<exelotl> yeah should be able to
23:27:18FromGitter<bung87> template/generic instantiation of `>` from here
23:27:29FromGitter<bung87> `if args.len > 0:`
23:30:26FromGitter<bung87> oh, another thing cause
23:35:14FromGitter<bung87> seems like can't pass varargs to another macro that accept varargs..
23:35:46FromDiscord<Clyybber> \> template/generic instantiation of > from here↵Thats not an error..
23:36:27FromGitter<bung87> `Error: invalid type: 'untyped' in this context: 'proc (x: varargs[untyped]): int{.noSideEffect.}' for proc`
23:36:35FromGitter<bung87> ok, the error message is
23:37:26FromDiscord<exelotl> varargs[untyped] can only be used in macros
23:37:45FromDiscord<mratsim> The unit in httpclient progress reporting seems wrong when i compare to my system monitor, anyone can reproduce? https://nim-lang.org/docs/httpclient.html#progress-reporting
23:37:55FromDiscord<exelotl> (and in templates, but that's only useful if you're forwarding it to a macro)
23:38:46*zacharycarter quit (Ping timeout: 246 seconds)
23:39:29FromGitter<bung87> yeah, am passing varargs from template to macro.
23:41:06FromGitter<bung87> `if args.len > 0:` I commented this then can compile
23:41:22FromDiscord<exelotl> but the error message says proc
23:42:37*abm quit (Read error: Connection reset by peer)
23:44:10*smitop quit (Quit: Connection closed for inactivity)
23:44:32PrestigeTrying to write a small snippet to ask a question but having trouble replicating the condition. Can someone tell me what's going wrong here? https://play.nim-lang.org/#ix=2n2y
23:45:22FromDiscord<Elegant Beef> getPFoo doesnt return
23:45:37PrestigeOh woops
23:45:52FromDiscord<Elegant Beef> Still errors though
23:46:17PrestigeYeah
23:47:23FromDiscord<Elegant Beef> Oh you dont intialize B
23:47:26FromDiscord<Elegant Beef> It's a ref object
23:47:37FromDiscord<Elegant Beef> https://play.nim-lang.org/#ix=2n2B
23:47:58PrestigeOh I didn't know I needed to do that, thanks
23:48:58FromDiscord<Elegant Beef> Well refs are on the heap and ar nilable
23:49:01FromDiscord<Elegant Beef> are*
23:49:48PrestigeJust thought it implicity initialized w/result, ty
23:50:05FromDiscord<Elegant Beef> nah the result always starts as the default value
23:50:10FromDiscord<Elegant Beef> in the case of refs, nil
23:50:44*exelotl joined #nim
23:51:20FromDiscord<exelotl> sent a code paste, see http://ix.io/2n2C
23:51:49FromGitter<bung87> ```system.len: proc (x: TOpenArray: openArray or varargs): int{.noSideEffect.}```
23:51:50*dadada joined #nim
23:52:10FromGitter<bung87> only this one looks like the error message shows.
23:52:14*dadada is now known as Guest81561
23:53:30FromDiscord<exelotl> I like how Nim has all this clever stuff to ensure my functions are threadsafe and prevent me from accessing guarded memory without a lock
23:53:44FromDiscord<exelotl> so that I can forget to initialise the lock and have my program silently fail
23:54:44FromDiscord<exelotl> bung87: can you share your code?
23:56:38FromGitter<bung87> almost like this https://play.nim-lang.org/#ix=2n2D
23:57:21FromGitter<bung87> am on devel , playground is 1.2
23:59:39FromGitter<bung87> https://github.com/nim-lang/Nim/blob/ef5b766a087c667b2f91393b2a913785396ba944/lib/impure/db_sqlite.nim#L785 in this template
23:59:55FromDiscord<Elegant Beef> Well exelotl use channels 😛