<< 31-12-2019 >>

00:02:56*nsf quit (Quit: WeeChat 2.6)
00:09:18*xet7 quit (Quit: Leaving)
00:45:23*tane quit (Quit: Leaving)
00:59:21*Hideki_ quit (Remote host closed the connection)
01:20:13*uu91 quit (Remote host closed the connection)
01:32:26*Hideki_ joined #nim
01:35:58muffindrakeIs there an identifier to refer to the current procedure in a string format akin to __func__?
01:36:57*Hideki_ quit (Ping timeout: 258 seconds)
01:48:21*aexoxea joined #nim
01:52:02*oculux quit (Ping timeout: 240 seconds)
01:53:43*oculux joined #nim
01:55:53FromGitter<gogolxdong> @shashlick, have you considered using clang to translate c/c++ projects to Nim, is it good? It's what I am trying. I'm not quite familiar with clang though.
01:58:06FromGitter<mratsim> @muffindrake you can hack together a way with func, there is a issue with the code by timotheecour
02:02:47muffindrakehttps://github.com/nim-lang/Nim/issues/8212
02:02:49disbotwe need a standard way to get name of procedure ; snippet at 12https://play.nim-lang.org/#ix=25Yt
02:02:50muffindrakeHuh.
02:04:09FromGitter<bung87> ```code paste, see link``` ⏎ ⏎ how can I implement the pragma logic? [https://gitter.im/nim-lang/Nim?at=5e0aac99eaa2cd096fcb67aa]
02:05:17FromGitter<gogolxdong> nimterop and c2nim both have limitations. Like the tree-sitter-cpp issue has not been commented for the pass three weeks.
02:19:44*dwdv quit (Ping timeout: 265 seconds)
02:29:53*ng0 quit (Quit: leaving)
03:07:48*muffindrake quit (Ping timeout: 248 seconds)
03:10:17*muffindrake joined #nim
03:16:36shashlick@gogolxdong - which issue?
03:16:53shashlicki considered clang originally but think it is a very heavy dependency
03:17:05FromGitter<gogolxdong> comment ast crash?
03:17:27shashlickmost linux and windows nim users just use gcc/mingw so asking for clang is too much
03:17:53*dddddd quit (Ping timeout: 260 seconds)
03:18:18FromGitter<gogolxdong> sure, I mean it could be a tool like c2nim.
03:18:53shashlickyes that's possible - recreating preprocessor calls in nim
03:19:39FromGitter<gogolxdong> https://github.com/eliben/llvm-clang-samples/blob/master/src_clang/tooling_sample.cpp
03:20:16FromGitter<gogolxdong> here, only if it compiles , we can modify c/c++ AST to Nim AST.
03:20:31shashlickwhat specific limitations are affecting you
03:22:52FromGitter<gogolxdong> c2nim has many unreconginzed token, as for nimterop you know better than me. and the most important is FFI, I think FFI is a dead end personally. It affects many thing.
03:23:29shashlickyou want to translate C/C++ into Nim outright?
03:23:52FromGitter<gogolxdong> yes.
03:24:18shashlickokay i'm not for that, but you already know my thoughts on that
03:24:23FromGitter<gogolxdong> at least pure c project.
03:25:10shashlickwhy don't you like the FFI?
03:25:43*endragor joined #nim
03:28:49FromGitter<gogolxdong> Like what I said before, 1.It limits macros 2. It requires addtional knowledge beyond the basic targeted language, and someone reminds me that we already has a better interoperate language example--D, which ends up somewhere.
03:29:33FromGitter<gogolxdong> when I come to FFI , I have to be skilled both at Nim and the targeted backend language to map everything properly.
03:30:28shashlickwell, with a good wrapper and helper procs, knowledge of backend language can be minimized
03:30:41shashlickand macros can also be targeted, i have some ideas around that
03:32:08FromGitter<gogolxdong> There is also some needs to rewrite c/c++ project in Nim, not just use their FFI.
03:33:15shashlickthe reason i prefer the FFI is because the upstream projects already have dedicated owners who are experts at what they are doing
03:33:43shashlickand all their efforts can be leveraged rather than translating and then maintaining a separate nim project that does the same
03:33:53FromGitter<gogolxdong> Translation is not only for better FFI, but an requirement to some extend.
03:34:02*Hideki_ joined #nim
03:34:11disrupteksome days, yes, but nim is not at that point yet.
03:34:32shashlickwhat's a good example where a translation is a requirement?
03:35:59FromGitter<gogolxdong> We are trying to rewrite git2 to improve Merkle DAG and don't want to write any c code.
03:37:30disruptekwhen you translate c->nim you end up with nim that doesn't exploit nim, but is shackled to c architecture. is this really what you want from your product?
03:38:46shashlickcheck out disruptek's Nim project on top of nimgit2
03:38:56shashlick!repo gittyup
03:38:57disbothttps://github.com/disruptek/gittyup -- 9gittyup: 11higher-level git bindings that build upon nimgit2 15 0⭐ 0🍴
03:40:37FromGitter<gogolxdong> Is it FFI or a translation?
03:41:10shashlicknimgit2 is wrapper over libgit2, gittyup is a Nim frontend over nimgit2
03:41:11disruptekit's ffi.
03:44:19disruptekbtw, are you sure libgit2 has everything you want in it?
03:45:42FromGitter<gogolxdong> Not sure, but aren't they the more reason to do the translation?
03:46:03disruptekwhat?
03:47:32disrupteki mean, i would guess that you'd want the result to include as much as possible of the finished product.
03:47:46disrupteklibgit2 is not as complete a git as git is itself.
03:47:55disruptekif that makes sense...
03:48:27FromGitter<gogolxdong> sure.
03:49:26FromGitter<gogolxdong> Is the translation hard as you think?
03:50:09disruptekshashlick is probably second only to araq in terms of expertise here.
03:50:37disruptekthough they favor different strategies, shashlick has wrapped many different c packages.
03:51:19FromGitter<gogolxdong> git has many features , we can just pick some to use or to improve if there was a Nim translation.
03:51:33shashlicki've not ever considered a full translation, practically speaking, even making C wrappers has been a long journey
03:51:44shashlickand i didn't deal with the preprocessor
03:52:10shashlickif you include preprocessor + full C, it will be a big undertaking
03:52:16shashlickand C is a moving target
03:53:06shashlickyou might want to research other C -> X translators and see what success folks have had
03:54:22FromGitter<gogolxdong> Can I take it as hard?
03:54:33disruptekyep.
03:54:38*Hideki_ quit (Ping timeout: 260 seconds)
03:55:09shashlickI'd call it tedious more than hard
03:55:12disruptekit will be a fair amount of work. at least you don't have to invent too much stuff.
03:55:19shashlickif you have worked with ASTs before at least
03:55:46shashlickyou need to understand the clang AST structure and Nim's AST if you want to use that to render Nim
03:55:59shashlickand then for every C syntax, translate one to the other
03:56:10shashlickand remember that some C may not have a Nim equivalent
03:56:31FromGitter<gogolxdong> FFI deserves disscussing all the time, we don't know which is the right thing from the perspective of future.
03:56:54disruptekyou can always start with ffi and replace stuff with handwritten nim.
03:57:07disruptekthat's kinda what gittyup is about.
03:57:39disruptekthe name is designed to elicit this idea of accelerating the process.
03:58:26shashlickyou might be better served to collaborate with disruptek
03:58:37shashlickhe's already neck deep in git2
03:59:07disruptekyeah, you are welcome, of course. i don't know if it's what you want, but i'm happy for people to get their hands dirty on it.
03:59:08shashlickhow many resources can you dedicate to this C -> Nim effort?
04:00:07FromGitter<gogolxdong> like not much but no options?
04:04:50*zama quit (Ping timeout: 240 seconds)
04:08:23FromGitter<gogolxdong> There is also one concern , I haven't use FFI massively for a product by far, but saw something like `ptr ptr ptr`, put the translations aside, is this GC'ed properly or manually managed when comes FFI ptr?
04:08:59disruptekso your options range from starting with something that works today, or spending a very long time with few resources doing something that essentially no one really does.
04:09:47disrupteksome of it is manually managed, because the c side performs allocations, while other bits are handled by nim.
04:10:27shashlickreally depends on the library - sometimes it allocates and deallocates itself, other times, you need to provide an allocated buffer to use
04:11:04shashlicklike a start() will return a buffer that is allocated and you use it in nim, then call an end() which will clear that buffer for you
04:12:48FromGitter<gogolxdong> Means there is potential memory safety vioaltions?
04:15:07disrupteksure.
04:21:23FromGitter<gogolxdong> Even Rust which declared memory safety has the same issue when comes to unsafe FFI. I have a feeling that any FFI will die evetually. Vioaltions are shipped together with the convenience they provided. Native survives.
04:21:56disruptekgreat, is that going to put a product in your pocket?
04:23:44shashlicki understand safety but the fact is that no one has time to reimplement established libraries with the same quality and capability when they have to build another product
04:23:54FromGitter<gogolxdong> There is a balance.
04:24:09shashlickif I want to talk ssh, i'll just use libssh2 instead of trying to recreate that in nim
04:25:00shashlickand i'll add some code to ensure that it is as safe as possible and that inexperienced C users don't mess up
04:25:33shashlickbut ya, if you are building a satellite or the next tesla which has life and death requirements, things can be different
04:25:46shashlickbut ultimately the line is drawn in $$$
04:26:17disruptekthat's really what it comes down to.
04:29:28*zama joined #nim
04:36:58FromGitter<gogolxdong> FFI is balance, when it takes more than it provides, it breaks.
04:43:48*chemist69 quit (Ping timeout: 248 seconds)
04:45:54*chemist69 joined #nim
04:46:24FromGitter<gogolxdong> You see it provides more for now and will see it takes more in the future.
04:50:59*rockcavera quit (Remote host closed the connection)
05:05:47FromGitter<rishavs> @vladar4, if you are here (or anyone else who knows); ⏎ how can i batch sprites in ng2? I dindt see anything related to batching in the docs.
05:15:18*leorize quit (Quit: WeeChat 2.6)
05:33:38*rockcavera joined #nim
05:56:51*ljoonal quit (Ping timeout: 268 seconds)
05:57:10*narimiran joined #nim
05:58:37*ljoonal joined #nim
06:31:34*nsf joined #nim
06:35:46*uu91 joined #nim
06:46:11*solitudesf joined #nim
07:14:59*Cthalupa quit (Ping timeout: 268 seconds)
07:16:42*Cthalupa joined #nim
07:36:40*crem quit (Ping timeout: 252 seconds)
07:38:31*crem joined #nim
07:52:01*Hideki_ joined #nim
07:56:37*Hideki_ quit (Ping timeout: 265 seconds)
08:00:00*gmpreussner quit (Quit: kthxbye)
08:01:50*Vladar joined #nim
08:05:09*gmpreussner joined #nim
08:10:51*NimBot joined #nim
08:12:04*slickFDDI joined #nim
08:12:15*slickFDDI left #nim ("WeeChat 2.7")
08:25:36*endragor quit (Remote host closed the connection)
09:00:31*Hideki_ joined #nim
09:01:05*Hideki_ quit (Remote host closed the connection)
09:10:46*matic joined #nim
09:30:09ZevvI have a use case where I want to make a gazillion string slices from a large openarray[char]; this sounds like a typical 'lent' thing, but I can't find a way to make the compiler understand what I want to do.
09:30:44Araqthere is an RFC for that but it's a terrible idea
09:30:51Araqinstead use indexes
09:31:29Araqusually the slices will store redundant data like (a, b), (b+1, c), (c+1, d)
09:31:33Zevvhow is it terrible? Shoudl it not be safe to have a read only view on any seq or string slice?
09:32:34Araqa borrowed pointer is more complex than an (owner, id) pair
09:33:00Araqthere is a reason it took Rust a decade of research to figure this out, it's complex, indexes are simpler
09:33:49Araqand since I looked at npeg's output ... trust me, you want simpler solutions :P
09:34:02Zevvyeah, but the consumer in the end always wants to use it as a string
09:34:05Zevvtell me what's wrong
09:34:12Zevvbecaue I think it is not as bad as you think it is
09:35:05Araqso create your own StringSlice type that works like that, but trust me, it's bad.
09:35:47Zevvbut seriously, is anything obviously wrong with what npeg creates?
09:36:06AraqI only looked at the test's output
09:36:25Araqand most of the junk comes from unittest.nim I guess
09:36:29Araq;-)
09:38:23Araqanyhow, here is how I do these things:
09:38:29Zevvright. This is typical npeg output for example: http://ix.io/25Zu, I think it is pretty lean. The computedGoto makes most of it disappear in the end, the whole FSM just goes away
09:39:13Araqyour mistake is the ': MatchResult'
09:39:53Araqyou can't reuse memory this way, you always need to construct new objects which probably contain new strings inside
09:40:06Araqso now you want to "borrow" them instead
09:40:26Araqbut then the function's result depends on 'ms_NP' not going out of scope
09:40:46*solitudesf quit (Quit: Leaving)
09:40:49Araqso in other words, you decoupled 2 things that are one and the same
09:41:03*ng0 joined #nim
09:41:03*ng0 quit (Changing host)
09:41:03*ng0 joined #nim
09:41:06*solitudesf joined #nim
09:41:15Zevvright, that makes sense
09:41:37Araqhere is what I do instead: proc parse(x: var State; tok: var Token)
09:41:57Araqand then I reuse 'tok' all the time
09:42:16Araqand then I copy the substring from the input stream indeed
09:42:31Araqbut this way I can actually handle *streams*, no need for mmap crap
09:43:06Araqand my input buffer can stay at 8K all the time
09:43:41Araqand then I have to copy the token's string into the AST. why? because I reuse the string immediately afterwards anyway, no allocations
09:45:19ZevvYeah, but that is *tokenizing*
09:45:47Araqyeah but ngep is for lexers
09:45:50Zevvproblem is still that with parsing I need to be able to refer to stuff anywhere in the past
09:45:56ZevvNoooohoo npeg is not for lexers only :)
09:46:21Araqwhatever, the principles remain
09:46:36Zevvtrue
09:46:42*Hideki_ joined #nim
09:46:54Araqand for ASTs use my packedjson ideas
09:47:15ZevvI never looked into that yet
09:47:15Araqactually I designed a superior IR somewhere...
09:47:56Araqbut guess what, this "superior" IR also copies stuff around, the input stream is simply ill-formed for any later step
09:50:19Zevvright
09:52:43Araqalso consider the locality aspects
09:53:14Araqproc constructAtom(x: sink string): Node = Node(value: x)
09:53:17Araqvs
09:53:29Araqproc constructAtom(x: string): Node = Node(value: x)
09:54:06Zevvdoes that make a difference with the default gc yet?
09:54:08AraqconstructAtom(move token.value) # ok, but then you need to allocate the token in the next step
09:54:45Araqso both ways have overhead and you need to measure
09:55:06Araqthe old GCs don't care about 'sink'
09:55:08Araqbut ARC does
09:55:15Araqand yet 'sink' is not always better
09:55:35Zevvwell that is where I got started yesterday, and I felt my use case would be a typical 'lent'
09:55:47ZevvI can prove the source string is still around for the lifetime of the lent slices
09:56:04Araqyeah as I said, it's an RFC away
09:56:21Araqbut this RFC is particularly imprecise
09:56:30ZevvIs that the RFC that allows openArrays to be passed around as first class objects?
09:56:34Araqyes
09:57:12ZevvI expect it has a lot of surprises
09:57:21Araqof course, use 'ptr UncheckedArray[char]; length: int' and ignore what I say
09:57:36AraqNim never really gets into your way
09:57:57Zevvha
09:58:26ZevvI do try to pay a bit of attention of what you're saying, every now and then :)
09:58:35Araqnice
09:59:07Araqthis --exceptions:goto stuff is great, I can add a .quirky pragma and we get quirky exceptions too
09:59:19Araqin the same build, for different code sections
10:00:08Araqand then I can win benchmarks without going to C++ generation :P
10:02:15Araqsuperb stuff
10:04:25FromDiscord<mratsim> @Araq, up to page 4 gives an alternative syntax for spawn/sync by using scoping: https://pdfs.semanticscholar.org/2cb7/ac2c3487aae8302cd205446710ea30f9c016.pdf
10:04:25FromDiscord<mratsim>
10:04:25FromDiscord<mratsim> Interestingly their scope can be independent from function boundary, you can start a scope in a child function, return and end the scope in the caller.
10:05:48FromDiscord<mratsim> The fully-Strict vs terminally-strict distinction is interesting as well (some of the C++ standard link I posted a couple of days before were arguing for fully-strict semantics but that means not being able to return a flowvar)
10:06:37FromDiscord<mratsim> some research bounded the number of cache misses for "well-behaved futures" (i.e. used in a fully-strict manner) but given my recent bench results I'm not too worried about the cache misses
10:07:24*Vladar quit (Quit: Leaving)
10:07:24*dwdv joined #nim
10:08:50*Hideki_ quit (Ping timeout: 240 seconds)
10:25:12*chemist69 quit (Ping timeout: 260 seconds)
10:26:08*chemist69 joined #nim
10:34:33*aexoxea quit (Quit: Goodbye!)
10:35:24*aexoxea joined #nim
10:50:16*enthus1ast quit (Ping timeout: 252 seconds)
11:04:40*enthus1ast joined #nim
11:14:05FromGitter<xflywind> Hi, I want to port python's lru_cache to Nim.How to implement it elegantly?I use macros to do it.But it looks so ugly. ⏎ ⏎ In Python ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e0b2d7db4ed68096e0967d6]
11:14:55FromGitter<xflywind> code in https://github.com/planety/cached/blob/master/cache/cache.nim
11:16:25*dddddd joined #nim
11:24:37*endragor joined #nim
11:37:01FromGitter<sheerluck> In Sydney, Australia, it's 1.5 hours left to new year, and in New Zealand it's already 2020
11:37:18FromDiscord<Clyybber> @Generic , skrylar: VCVRack probably
11:38:06FromDiscord<Clyybber> @mratsim Nice, did you switch the default back to random thief selectiom?
11:43:41*Trustable joined #nim
11:46:34FromGitter<sheerluck> 🅟 🅐 🅡 🅣 🅨 like it's the last day of Python 2!
11:48:00FromGitter<bung87> is there anything else I need concern for droping index in sqlite memory database? I checked it from sqlite_master, it still exists
11:53:17muffindrakeAccording to my head, 100 + 1 is 100. Amazing.
11:54:57*narimiran quit (Ping timeout: 268 seconds)
12:04:54*Trustable quit (Remote host closed the connection)
12:04:59*Hideki_ joined #nim
12:17:16*xet7 joined #nim
12:26:17Zevvaccording to my head 1980 is twenty years a go, and so is the year 2000
12:26:45Zevvpotje dan maar
12:26:54*Hideki_ quit (Remote host closed the connection)
12:28:39*Hideki_ joined #nim
12:33:11*Hideki_ quit (Ping timeout: 268 seconds)
12:36:23FromGitter<alehander92> @xflywind use {.cached.}
12:36:58FromGitter<alehander92> like `: string {.cached.}`
12:37:30FromGitter<alehander92> proc a .. {.cached.} =
12:37:39FromGitter<alehander92> similarly to how {.async.}
12:37:43FromGitter<alehander92> is defined
12:41:03FromGitter<alehander92> @clyybber
12:41:07FromGitter<alehander92> what do you think about
12:41:29FromGitter<alehander92> @krux02 , about adding an `{.init.}` or `{.constructor.}` pragma
12:41:32FromGitter<alehander92> to types
12:42:03FromGitter<alehander92> so e.g. one can have the default fields and also use default fields which require allocation in a autogenerated `init` constructor
12:42:11FromGitter<alehander92> hm probably it would be confusing
12:42:22FromGitter<alehander92> for reading ..
13:03:13FromDiscord<mratsim> @clyyber yes default is back to random
13:03:20FromDiscord<mratsim> @Clyybber*
13:03:49FromDiscord<mratsim> What's the use of declaredInScope? does that mean visible or visible but also declared in the current block?
13:10:23*Hideki_ joined #nim
13:19:08*Hideki_ quit (Remote host closed the connection)
13:19:24*Hideki_ joined #nim
13:22:12*Kaivo joined #nim
13:27:37*endragor quit (Remote host closed the connection)
13:29:20*endragor joined #nim
13:29:34*endragor quit (Remote host closed the connection)
13:30:01*endragor joined #nim
13:34:33*endragor quit (Ping timeout: 258 seconds)
13:35:15FromGitter<xflywind> @alehander92 thanks.
13:35:39*endragor joined #nim
13:40:24*endragor quit (Ping timeout: 268 seconds)
13:43:42FromGitter<xflywind> Maybe we can use macros to implement decorators like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e0b508e2d574c7d1ee96956]
13:51:06*endragor joined #nim
13:56:36*endragor quit (Remote host closed the connection)
13:56:50*endragor joined #nim
13:58:32*narimiran joined #nim
14:02:52FromGitter<xflywind> we need Interceptor like this, but haven't found an elegant way.
14:03:13FromGitter<xflywind> (https://files.gitter.im/nim-lang/Nim/xR6c/QQ-Tu-Pian20191231220228.jpg)
14:07:06Yardanicowhat about pragmas?
14:11:20FromGitter<xflywind> how to nest pragmas?
14:18:59FromGitter<alehander92> i'd say that you have to be careful with this, you can use one pragma
14:19:05FromGitter<alehander92> which can take "arguments"
14:19:12FromGitter<alehander92> because i'd like to know that if i use such a dsl
14:19:17FromGitter<alehander92> it is relatively well optimized
14:19:28FromGitter<alehander92> i wouldnt want to have 5 nested function calls usually imho
14:19:44*Hideki_ quit (Remote host closed the connection)
14:21:15FromGitter<alehander92> so you can have something like ⏎ {.middleware: ⏎ [setMetaData, ⏎ userInterceptors( ⏎ ... [https://gitter.im/nim-lang/Nim?at=5e0b595bb3e5ce46e4a3d080]
14:21:25FromGitter<alehander92> but this is purely subjective i guess
14:22:26*Hideki_ joined #nim
14:22:36*belamenso joined #nim
14:22:39FromGitter<alehander92> of course your `decorator` macro can indeed to the same
14:25:15belamensoHi, is this a bug in Nim that I should report, or did I misunderstood something? https://play.nim-lang.org/#ix=2611
14:25:57Yardanicobelamenso: well, I'm not sure if the code is correct, but compiler crashes are always bugs :)
14:26:56FromGitter<alehander92> yes
14:27:04FromGitter<alehander92> and in this case indeed i dont think you can just pass `g`
14:27:08FromGitter<alehander92> because when you use `|`
14:27:16FromGitter<alehander92> you get a generic ! function
14:27:30FromGitter<alehander92> so you need to somehow pass only one specialization of `g`
14:27:43FromGitter<alehander92> but indeed this needs a proper error
14:27:56FromGitter<alehander92> so it is a small actual bug indeed
14:28:00belamensog[proc(_:int):int] g
14:28:01belamensothis works fine
14:28:10FromGitter<alehander92> ah exactly
14:28:31FromGitter<xflywind> @alehander92 oh,thanks.I'll try it.
14:30:36FromGitter<alehander92> ah not exactly belamenso not sure how it exactly works indeed ..
14:30:39FromGitter<alehander92> but you can open an issue
14:30:44FromGitter<alehander92> and wait for others there
14:33:10belamensoSo it's a compiler crash during generic parameter resolution?
14:38:05*Vladar joined #nim
14:38:55*zyklon joined #nim
14:41:01*nsf quit (Quit: WeeChat 2.6)
14:42:44*uvegbot quit (Ping timeout: 248 seconds)
14:44:37*Hideki_ quit (Remote host closed the connection)
14:45:24*Hideki_ joined #nim
14:47:29*endragor quit (Remote host closed the connection)
14:47:38*endragor joined #nim
14:55:45Araqit's one of these days ... turns out my exception handling can now handle complex cases but fails for easy cases
14:56:26YardanicoMaybe you should rest today, it's 31th december :P
14:59:46ozrest, or drink some champagne, both?
15:01:39FromGitter<zetashift> Maybe he finds working on Nim relaxing
15:01:43FromGitter<zetashift> checkmate there
15:05:31*krux02 joined #nim
15:08:24*ng0_ joined #nim
15:08:24*ng0_ quit (Changing host)
15:08:24*ng0_ joined #nim
15:11:40*ng0 quit (Ping timeout: 268 seconds)
15:20:45*Hideki_ quit (Remote host closed the connection)
15:21:33*ng0_ is now known as ng0
15:22:13*Hideki_ joined #nim
15:23:58*Hideki_ quit (Remote host closed the connection)
15:24:14*Hideki_ joined #nim
15:35:02*Hideki_ quit (Remote host closed the connection)
15:35:21Yardanicolol https://github.com/belamenso/v
15:35:36belamensoWait, I'm working on it, it's not ready
15:35:45belamensoStill has a few bugs
15:35:54Yardanicobelamenso: I was just looking through latest updated nim projects :)
15:36:00Yardanico"language:nim pushed:>2019-12-28"
15:41:32*Hideki_ joined #nim
15:47:16Araqgetting this test suite to be green is a pita
15:47:50Yardanicobelamenso: i hope the letter `v` was ironically inspired by v language :P
15:49:56belamensoIt was mostly inspired by the fact that Nim parses the template before giving it to you. This means that you can't do many really interesting things with metaprogramming in Nim
15:50:14belamensoeg. you can accept 1 -------- 5 as an input to your macro, but not ---------
15:50:25Yardanicowell, all code in .nim must be valid nim syntax :)
15:50:37*natrys joined #nim
15:50:38belamensoInitially I wanted to just use _, but for this reason was impossible
15:51:03Yardanico"While macros enable advanced compile-time code transformations, they cannot change Nim's syntax. However, this is no real restriction because Nim's syntax is flexible enough anyway."
15:52:28Araq"can't do many interestings things with metaprogramming in Nim" omg
15:52:43Araqmost hilarious statement since quite some time
15:52:47muffindrakeWe need a snake operator _-‾-_-‾---
15:52:56belamensoAlso there's this really weird thing happening, I don't understand it fully, preventing you from having a single macro name in a line, you have to discard it or else it won't parse
15:53:19belamensobut if you discard it, you get exception of invalid discard since it clashes with your generated code
15:54:01Araqmetaprogramming has nothing to do with syntax, look at Lisp if you don't believe me
15:55:22belamensoI do not mean "you cannot do it, it's impossible", but "you can't do it with this syntax"
15:55:30belamensofor this project the latter is more important
15:55:56Araq"""
15:56:09Araqlook, custom DSL with custom tokens allowed here
15:56:15Araq""".parseAtCompileTime
15:56:43Araqstill rather simple to do...
16:03:00disruptekzevv: hearts and minds!
16:04:33Zevvwhy *me*?!
16:04:38Zevvwhat did I do?
16:04:45Yardanico👀
16:05:54disruptekask vixie.
16:07:15*MarquisdeFalbala joined #nim
16:07:31disruptekwhy am i even trying to get bump working on 0.19.6.
16:07:48disruptekshashlick is right, travis is a slave driver.
16:10:20Zevvdig what.did.I.do
16:11:32*Hideki_ quit (Remote host closed the connection)
16:12:36*Hideki_ joined #nim
16:12:45FromDiscord<Clyybber> disrtuperkt: Bearutiful: https://disruptek.github.io/gittyup/gittyup.html
16:13:15disrupteki know. never build your docs with nim 1.1.1.
16:14:27disrupteknimph canary for gc:arc: https://github.com/disruptek/nimph
16:14:33disrupteksome day...
16:15:19lqdev[m]🎵someday I'll find my peace
16:17:42disruptekzevv, you promised to make me something amazing today.
16:20:49disruptekTIL if {x} == {a,b}:
16:20:55disruptekcute.
16:26:29disruptekwhy is `normalizePathEnd` not exported?
16:30:37*Hideki_ quit (Remote host closed the connection)
16:31:40Araqdisruptek, the stdlib is a dick
16:32:10disruptekjust makes a 2-line reimpl of `lastPathPart` for 0.19.6 into a clusterfuck.
16:32:24*Hideki_ joined #nim
16:33:54Araq0.19.6? is it 2018 once again?
16:34:07disruptekeverything old is new again some day.
16:37:23*Hideki_ quit (Ping timeout: 268 seconds)
16:43:58Araqproc m =
16:43:58Araq raise newException(OSError, "Problem")
16:43:59Araqm()
16:44:02Araq# ^ works
16:44:10Araqraise newException(OSError, "Problem")
16:44:14Araq# ^ fails
16:44:47Araqprobably related to my addQuitProc code...
16:44:52disruptekkinda annoying how often stuff behaves differently in global scope.
16:45:14AraqI am describing a new bug in my branch
16:45:23disrupteki know; i'm thinking of loop variables here. 😁
16:45:51*Hideki_ joined #nim
16:46:13disruptekgetCurrentProcessId isn't in 0.19.6, either. it's like using a time machine to visit the stone age.
16:46:30*endragor quit (Remote host closed the connection)
16:46:54Araqstop messing with 0.19.6 please
16:47:10Araqit's unsupported
16:47:22Araqthe point of v1 was to say "everything else is dead, enjoy"
16:47:54disruptekif that's true, it should shave a few millenia off ci tests everywhere.
16:48:00FromDiscord<Clyybber> I agree, supporting 0.19.6 seems so pointless
16:48:07Araqargh!
16:48:13FromDiscord<Clyybber> whos still using it anyways?
16:48:19Araqwe destroy the current exception!
16:48:29Araqand thus it cannot raise. lol
16:48:32Araqwhat a bug
16:48:41FromDiscord<Clyybber> introduced by me?
16:48:42*marmotini_ joined #nim
16:48:44Araqwe need a .nodestroy for globals
16:48:47Araqno, me.
16:49:03FromDiscord<Clyybber> but I started the whole destroy globals thing no?
16:49:12FromDiscord<Clyybber> hehe, latent bug
16:49:36Araqgood news is that it seems to be the "last" bug so far
16:49:43Araqall the other painful tests are greening
16:49:44disruptekif it's not new, i remember a couple open issues that could be related to.
16:49:46FromDiscord<Clyybber> nice
16:50:04Araqboy this was harder than anticipated
16:50:47Araqtook me 4 full days to write a new exception handling mechanism
16:50:49Zevv*except-io-nally* hard
16:51:15Araqmore than the 2 days than I estimated
16:51:17disruptekaraq is getting rusty.
16:51:23Yardanicooh no
16:51:27Zevvba-dum-chhhh
16:51:32Araq:P
16:51:42FromDiscord<exelotl> anyone got simple examples of how to use the pegs module? The docs are a bit overwhelming
16:52:50Araqwithout the 'setjmp' the code is almost readable now
16:53:07Araqexelotl: use npegs and ask Zevv about it
16:53:45*Araq wish he could deprecate pegs.nim
16:53:51Zevvaw araq you're making me cry!
16:54:19disruptekit's ok, there's plenty of other code in the compiler that remains unreadable, zevv.
16:54:26Zevvpfew!
16:54:32disruptek😀
16:56:00muffindrakeWhat part of the standard library would be best for separating command lines into arguments, with escaping spaces and the like?
16:56:10disruptek!repo cligen
16:56:11disbothttps://github.com/c-blake/cligen -- 9cligen: 11Nim library to infer/generate command-line-interfaces 15 134⭐ 10🍴 7& 1 more...
16:56:17Yardanico"part of stdlib" lol
16:56:28disrupteki consider it stdlib.
16:56:29Yardanicomuffindrake: https://nim-lang.org/docs/parseopt.html or parseopt2
16:56:36FromDiscord<Clyybber> cligen is basically stdlib
16:56:40Yardanicooh parseopt2 is gone its parseopt
16:56:42FromDiscord<Clyybber> inofficial stdlib
16:56:45Araqhttps://nim-lang.org/docs/os.html#parseCmdLine%2Cstring
16:57:02muffindrakeThank you!
16:57:14disruptekmaybe i should make araq a distribution so he can see what a bad idea it is. 😆
16:57:46Araqyou mean we need to be careful not to break important packages that are part of the distro?
16:57:55Araq;-)
16:58:11Araq(exactly what we're doing already)
16:58:16disrupteki think it really says something that i don't even keep copies of my library repos on my local filesystem anymore, except as dependencies.
16:59:47FromGitter<deech> Aside from `option` is there a better way of doing "nil threading" in the standard library?
17:00:48FromDiscord<Clyybber> deech: Better in what sense?
17:00:51FromDiscord<Clyybber> I don't think so.
17:01:32Araqmaybe use exceptions instead
17:02:05*zidsal joined #nim
17:02:16disruptekwhat's "nil threading"?
17:02:41FromGitter<deech> I'm just chaining together `a.option.flatMap((b) => b.something.option).flatMap((c) => c.somethingelse.option)`
17:02:43Yardanicodisruptek: maybe threading as in (yarn)
17:02:51Yardanicoyes, chaining basically
17:03:42FromGitter<deech> I could make a template that captures the pattern but wanted to make sure I wasn't missing something.
17:05:58FromGitter<deech> BTW I'm using this to burrow through a bunch of XML nodes. Can' t find any XPath like thing.
17:06:15disruptekno, i don't think such an animal exists yet.
17:07:06disrupteki like nim-result. i think it should be in stdlib, but perhaps with a different name.
17:07:21disruptek!package nim-result
17:07:21disbotno packages match 😢
17:07:24disruptek!package result
17:07:25disbothttps://github.com/arnetheduck/nim-result -- 9result: 11Friendly, exception-free value-or-error returns, similar to Option[T]
17:07:42FromGitter<deech> Yah, XPath is nuts. Do appreciate having an simple xml parser in the std lib.
17:09:21shashlickWasn't status still using 0.19.6?
17:09:41shashlickLots of when statements in nimterop for 0.19.6
17:10:02disrupteki think they may be fully on 1.0.2 now.
17:10:09FromDiscord<mratsim> 1.0.4
17:10:17disrupteknice.
17:10:30shashlickOh nice - will be interesting to see if anyone else is still using it
17:10:32zidsalhi guys I'm new to nim, I'm trying to map types to a specifc number, I've used a Table like this `let foo = Table[type, int]` however I get the following error `'typedesc' metatype is not valid here; typed '=' instead of ':'` can anyone point me in the right direction?
17:10:55disrupteks/type/YourType/
17:11:00shashlickI'm still supporting it in my libs
17:11:05disruptekadd ()
17:11:20shashlick0.19.6, 0.20.2, 1.0.4 and devel
17:11:23disruptekand you probably want it to be a var. aren't there examples of this in stdlib?
17:11:28FromDiscord<Clyybber> just ditch it
17:11:31FromDiscord<Clyybber> don't support it
17:11:36*Hideki_ quit (Remote host closed the connection)
17:11:40FromDiscord<mratsim> types are a compile-time only construct, they can't exist in the final binary file @zidsal
17:12:17*Hideki_ joined #nim
17:12:47FromDiscord<mratsim> what are you trying to do?
17:12:56shashlickWell at this point, it is work to remove support
17:13:15shashlickBut ya, all new code I'm doing could use the smaller test surface
17:13:43shashlickAraq: I'm enjoying the compiler AST
17:13:52shashlick$nim is the way to go
17:13:58disruptekright?
17:14:06FromDiscord<zidsal> @mratsim I'm trying to write a small ecs, I wanted to absically make a bit mask of my compontent types so I can quickly find entities that have both A & B
17:14:23FromDiscord<mratsim> use enums + sets
17:14:37disruptekyeah, welcome to nim, buddy.
17:15:34FromDiscord<zidsal> the problem with an enum is it means you'd need to update it everytime someone addds in a new component (a new type) that seems a bit sucky?
17:15:44disruptekhow do you figure?
17:15:58disruptekyou'd rather have data floating around that has no semantic value?
17:16:00shashlickI'm converting the nimterop backend to generate Nim AST which then gets rendered by compiler
17:16:11FromDiscord<mratsim> a bit salty today disruptek
17:16:22disrupteki know, sorry. i dunno what my problem is.
17:16:26*Hideki_ quit (Ping timeout: 240 seconds)
17:16:35disrupteki promise i'm not trying to be a dick. just a natural at it, i guess.
17:16:38disruptekyears and years of practice.
17:16:49Araqzidsal: I would use enums too fwiw
17:16:55Araqbbl, party time here
17:16:56FromDiscord<zidsal> @disruptek if that was directed at me, if I made this ecs a nimble package it means you wouldn't be able to add in new components
17:17:11FromDiscord<mratsim> @zidsal, yes that's the expression problem, there are (complex) way around it but if you want to find stuff fast enums + sets are the fastest way possible, and it doesn't allocate
17:17:20disruptekahh, that's a new kettle of fish.
17:17:53FromDiscord<mratsim> here is a very involved example of extensible enums: https://github.com/mratsim/compute-graph-optim/blob/master/e07_part3_var_ADTs_user_extension.nim
17:17:55disruptekyou need another abstraction to add new ranges, etc.
17:17:56*Hideki_ joined #nim
17:19:35FromDiscord<mratsim> basically I have a compile-time table of enums (aka components), users can register new enum values, and when they need the enum, they call genExprEnum
17:19:48FromDiscord<mratsim> i.e. user extensible enums
17:20:11FromDiscord<zidsal> ya thats exactly what I need thanks
17:20:19FromDiscord<mratsim> in the example I have Lit and Add, and I register a new enum called Mul
17:20:51*Hideki_ quit (Remote host closed the connection)
17:21:37FromDiscord<mratsim> This uses the same technique to generate very efficient state machine: https://github.com/mratsim/Synthesis/blob/master/synthesis/factory.nim#L77
17:21:37FromDiscord<mratsim>
17:21:37FromDiscord<mratsim> A compile-time table that holds enums/identifiers
17:21:54FromDiscord<mratsim> user can register their own, and then generate it as needed
17:21:56*Hideki_ joined #nim
17:24:50FromDiscord<mratsim> Before diving deep into macros and metaprogramming I suggest you use a fixed enum first though
17:25:27*endragor joined #nim
17:25:34FromDiscord<zidsal> ya thats what I was planning on doing, sonly really started playing around with nim yesturday
17:26:22disruptekwelcome; not all of the community is as caustic as i am, today. 😄
17:26:28*Hideki_ quit (Ping timeout: 258 seconds)
17:26:51FromDiscord<mratsim> the challenge is finding a challenge for disruptek because he said he was bored
17:27:30disruptekit's hard finding steps short enough for stupid people.
17:27:36disrupteki have the same problem with my dog.
17:27:46disruptekso far, all i've managed to teach him is how to lick his asshole.
17:27:51*marmotini_ quit (Remote host closed the connection)
17:27:56disruptekand it took me three weeks of tedious demonstration.
17:28:09disruptekon the plus side, i've never been so squeaky clean.
17:28:26shashlickI think he already knew that so your efforts were likely futile
17:28:55disruptekare you saying someone got to him first?
17:29:23shashlickSome things are builtins
17:29:36shashlickOr magic
17:29:38*endragor quit (Ping timeout: 240 seconds)
17:29:45disruptekit took my dog three weeks to get tired of watching me lick myself.
17:29:52disruptekthat's the basic take-away here.
17:30:46shashlickSorry if it left a bad taste
17:31:05disrupteki'll try anything once.
17:32:08FromGitter<sheerluck> @disruptek try to implement qt5 bindings in nim please
17:32:35disruptekpeople aren't coding in nim because there exist no comprehensive qt5 bindings?
17:34:35FromDiscord<mratsim> they aren't coding in Nim for various reason dependig on their background:
17:34:35FromDiscord<mratsim> - not available in NPM :D
17:34:35FromDiscord<mratsim> - no repl
17:34:35FromDiscord<mratsim> - imports
17:34:35FromDiscord<mratsim> - weird case sensitivity
17:35:04FromGitter<sheerluck> @mratsim I have repl it's inim
17:36:07FromDiscord<mratsim> I have yet to try it, but I'm worried about the program speed (I really need them to be in release/danger) and if it can handle raw malloc / cudaMalloc
17:36:19FromGitter<sheerluck> @mratsim weird case sensitivity is a HUGE plus coz i like walk_dir not walkDir so the ONLY reason I can stand all that is Wonderful Nim allows me to write code the way I love
17:36:50FromDiscord<mratsim> you don't have to convince me but the HN and redit crowd
17:39:44FromGitter<sheerluck> well potatoes gonna potate
17:40:06FromGitter<deech> Yea, that case sensitivity stuff has and will keep coming up for as long as Nim is around, has already happened to me. Only way around is to have a few large codebases where it isn't a problem. Even in my little experiments I've been bit by not being able to grep easily.
17:40:52FromGitter<deech> IMO a repl would be great but not essential, most aren't used to one.
17:44:08FromGitter<deech> Also could use more people doing talks on it from the context of their experience.
17:49:00FromDiscord<mratsim> it's essential for data science
17:51:19FromGitter<deech> Not my area but I believe it.
17:55:24madpropsi like just walkdir, since it's short, but lately i
17:55:30madpropsve just been using whatever the autocomlete suggests
17:55:47*Hideki_ joined #nim
17:56:09madpropsso walkDir probably
17:57:40madpropswouldn't a repl be trivial to implement?
17:58:06madpropsoh well it would beed to store every step
17:58:23madpropsand compile on each step probably
17:58:59Zevvwe've seen a few people try to make it
17:59:36disrupteki could see it happening in 2020. hcr and ic are pretty unstable, but i don't think there are major technical hurdles.
18:01:01disruptekthat could be a fun challenge. 😈
18:07:42*NimBot joined #nim
18:07:59*zidsal quit (Ping timeout: 260 seconds)
18:14:28*Hideki_ quit (Ping timeout: 260 seconds)
18:18:20FromDiscord<Skaruts> What's the most appropriate time function for calculating a delta-time for a game?
18:20:07shashlickI use nimgrep for grepping
18:20:57FromDiscord<Skaruts> I found monotime in the docs, but it doesn't seem to exist (Error: cannot open file: std/monotimes -- also tried without "std/")
18:21:10FromDiscord<Skaruts> maybe that's because I'm still on 0.20.2?
18:22:55Yardanicouh, why using an ancient nim version? :P
18:24:11FromDiscord<Skaruts> I've been away 🙂
18:24:59FromDiscord<exelotl> trying to figure out nim-regex and it's driving me insane :(
18:25:28FromDiscord<exelotl> there's like 20 functions and none of them do what I want
18:26:57FromDiscord<exelotl> I have a line like `#define SFX_JUMP 1` and I want to get a seq with `@["SFX_JUMP", "1"]`
18:27:18Yardanicowhy not use split or strscans in this case?
18:28:35FromDiscord<exelotl> oh strscans seems like what I want
18:28:43FromDiscord<exelotl> thanks
18:29:26*nsf joined #nim
18:29:32Zevvand there's always npeg :)
18:31:40*aexoxea quit (Quit: Goodbye!)
18:34:16FromGitter<matrixbot> `grantmwilliams` > <@gitter_fromirc:matrix.org> *<shashlick>* I use nimgrep for grepping ⏎ ⏎ Why do you like nimgrep? I've been using ripgrep recently, but havent really heard anything about nimgrep
18:35:03Yardanicouhh, this chain is so confusing, can you use matrix bridge? :P
18:35:17YardanicoFreenode has a matrix bridge so you can be in this IRC channel "natively" without any obvious bridges
18:36:24FromGitter<matrixbot> `grantmwilliams` im in gitter right now. clicked on the reply to name button... maybe i should avoid the UI options
18:36:45Yardanicowell, I mean https://matrix.org/blog/2015/06/22/the-matrix-org-irc-bridge-now-bridges-all-of-freenode/
18:39:30FromDiscord<Skaruts> the docs ought to mention when some feature was added
18:40:10disrupteki think there's a ticket for adding .since to `nim doc`.
18:40:41FromGitter<deech> Zevv, just used 'npeg' for some stuff and it's pretty great.
18:42:27Zevvsweet, good to hear that
18:43:00FromGitter<deech> As a suggestion it would be nice of there was a way of saving names with captures. so like: ⏎ ⏎ ``` ... <- CaptureName("aToC", >{'a',...,'c'}*): ⏎ echo capture["aToC"]``` ⏎ ⏎ or something like that. [https://gitter.im/nim-lang/Nim?at=5e0b96b30fd3413f4c85b83b]
18:44:18FromGitter<deech> Also '-d:npegDumpDot` seems to have no effect.
18:45:22Zevvsomething similar used to be possible, until recently it was possible to capture to JSonNode objects and put that in a json object, but I dropped that for sake of simplicity. No one complained about the deprecation :)
18:45:44Zevvoh is dot broken, will look at that. I never use that myself and there is no test for it I guess
18:46:14FromGitter<deech> Ok, def. not worth additional complexity just a nice-to-have if it's easy.
18:46:20disrupteki think it's out-of-scope to do the json construction.
18:46:38*rockcavera quit (Remote host closed the connection)
18:47:14Zevvwell, that was legicy. before there were code block captures npeg could only capture to json objects
18:47:17Zevvbut that was a mistake
18:47:39Zevvi just used that because it is a proven object type to store complex structured data
18:47:46FromGitter<matrixbot> `grantmwilliams` Do the Nim docs link to source code anywhere?
18:48:01FromGitter<deech> Why not a hash table?
18:48:33Zevvjust seemed like a good idea at that time
18:48:39FromGitter<matrixbot> `grantmwilliams` nevermind im extremely dumb. i spelled source wrong *face palm*
18:50:33FromGitter<phillvancejr> why doesn't this work?
18:50:36FromGitter<deech> Is `ref ..` the last remaining place in Nim where `nil` can occur?
18:50:58FromGitter<deech> Aside from C pointers, ofc.
18:51:57disruptekinteresting question.
18:53:14Zevvdeech: dot works, but the README is wrong in one place: use -d:npegDotDir=. instead
18:53:29FromDiscord<Clyybber> deech: Yes, only pointers and refs can be nil,
18:53:46FromGitter<deech> Cool, will try that. Was it putting it in `/tmp` or something before?
18:54:11Zevvwhere you point it, so -d:npegDotDir=/tmp should work
18:54:37FromGitter<deech> I meant when I didn't specify that before did it default to some other location
18:54:53Zevvoh I think it was always like this?
18:55:08FromGitter<deech> Cool, thanks!
18:55:27FromGitter<deech> Re: `ref` and `nil` that's great.
18:55:47*Skaruts joined #nim
18:56:12disruptek-d:foo=bar syntax was only supported on the cli until recently.
18:56:27disrupteknim.cfg syntax is -d:foo="bar" actually.
18:56:54FromDiscord<Skaruts> installed 1.0.4 now and I'm getting an `error: size of array 'Nim_and_C_compiler_disagree_on_target_architecture' is negative typedef int Nim_and_C_compiler_disagree_on_target_architecture[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];`
18:57:09disruptekyeah, you have to code around it.
18:57:36FromDiscord<Skaruts> I don't know what it means
18:58:37SkarutsI had it before but I can't remember what it was about...
18:59:45Skarutsmaybe this part is relevant too?
18:59:51Skaruts`Error: execution of an external compiler program 'gcc.exe -c -w -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN -IC:\nim-1.0.4\lib -IJ:\Programming\Nim\roguelikes\rl-
19:07:06*MarquisdeFalbala quit (Ping timeout: 252 seconds)
19:09:09FromDiscord<demotomohiro> You get that error because Nim compiler trying to build 64bit executable but your backend C compiler is trying build 32bit exe
19:29:03Skarutsforgot to install minGW that's what it was... :S
19:29:12Skarutsall good now
19:48:46FromGitter<matrixbot> `silvernode` echo "Hello everyone!"
20:11:26*Hideki_ joined #nim
20:14:00*belamenso quit (Remote host closed the connection)
20:15:54*Hideki_ quit (Ping timeout: 258 seconds)
20:17:26FromGitter<deech> What does the `<//>` syntax mean here? `proc newTable*[A, B](initialSize = defaultInitialSize): <//>TableRef[A, B] = ...`
20:17:49disruptekit's a placeholder for owned in pre-owned code.
20:19:06FromGitter<deech> Can you link to any docs? I can't seem to find it here: https://nim-lang.org/araq/ownedrefs.html.
20:19:27disruptekit's an artifact of the impl afaik; don't sweat it.
20:20:35FromGitter<deech> Thanks!
20:21:02disrupteksorry there isn't more to offer there. 😉
20:23:42shashlick@grantmwilliams: nimgrep comes with Nim and can search with style insensitivity - which is why I mentioned it as an option to solve that issue
20:25:38FromGitter<deech> Ok one more. :) What's the difference between `do:` and `block:` outside of a macro's `quote do:` context?
20:25:58FromGitter<deech> I'm guessing `block:` has to return a value and `do:` doesn't?
20:28:02Araqthere is a verv different parsing rule involved
20:28:04Araqyou can do
20:28:06Araqfoobar:
20:28:11Araq echo "section A"
20:28:13Araqdo:
20:28:16Araq echo "section B"
20:28:23Araqand it's all passed to 'foobar'
20:28:28Araqblock cannot do this
20:28:53Araqlater on we figured we don't need 'do'... and it's an unloved child ever since
20:30:16FromGitter<deech> A bunch of the standard lib docs still use `do:`.
20:30:35FromGitter<deech> `withValue` in `tables` is an example.
20:31:42FromGitter<deech> In your example are you saying that you can't do: ⏎ ⏎ ```foobar: ⏎ block: ⏎ echo "section A" ⏎ block: ⏎ echo "section B"``` [https://gitter.im/nim-lang/Nim?at=5e0bb02e07a1a67d1d8e1c4b]
20:32:44Araqyes, 'quote do' also comes to mind
20:33:08Araqand please don't misunderstand me
20:33:25Araq'do' is required and cannot be replaced with 'block'
20:33:41Araqit's just that there are alternative, better API designs solving the same problem
20:33:54Araqfor example
20:34:53Araqtable.tryGetValue(key):
20:35:04Araq hasValue(val):
20:35:07Araq noValue:
20:35:25Araqmore indentation and subsections are easier to read
20:37:50Araqer, Clyybber
20:37:59Araqdestroying thread local vars seems wrong to me
20:38:13Araqif we only destroy them for the main thread anyway
21:04:24*nsf quit (Quit: WeeChat 2.6)
21:10:04FromGitter<sheerluck> btw happy new year 2020
21:16:00enthus1astcan someone unlock the new forum user Dankrad please :)
21:20:30FromDiscord<Lantos> dom96: whats the best way to access vars window in karax? also if there a way to add a custom attr to a component?
21:20:30FromDiscord<Lantos> script(src="..blah.js" defer)
21:20:44FromDiscord<Lantos> window vars*
21:22:36FromDiscord<Skaruts> how am I getting an order of magnitude discrepancy here? Both calculations are the exact same:
21:22:51FromDiscord<Skaruts> `dt = float64(getMonoTime().ticks-t) / 1000000.0`
21:22:55FromDiscord<Skaruts> `echo dt, " | ", float64(getMonoTime().ticks-t) / 1000000.0 #>>> 0.001136 | 0.014484`
21:34:31*mal`` quit (Quit: Leaving)
21:45:49FromDiscord<Milerius> happy new year everyone :p
21:49:11FromDiscord<Lantos> Happy New year!
21:49:14Yardanicoyou too :P although it's 2020 only for people in UTC+3 or higher rn
21:49:14*uu91 quit (Ping timeout: 240 seconds)
21:55:29*natrys quit (Quit: natrys)
21:55:41FromGitter<deech> Is this a bug? I get `{"a": 1, "a": 2}` when I run: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e0bc3dc0c3aeb107d841f44]
21:57:29*mal`` joined #nim
21:58:10Zevvnope
21:58:30Zevvthis comes up every so often and is a big surprise to everyone who finds out
21:58:39FromGitter<deech> I'm surprised.
21:58:46ZevvI said so :)
21:58:54disrupteki can't read gitter; is it the multi-value thing?
21:58:58FromGitter<deech> Not even my birthday.
21:59:04ZevvDid you read the manual? Because then you would not be surprised
21:59:06Zevvhttps://nim-lang.github.io/Nim/tables.html#add%2CTable%5BA%2CB%5D%2CA%2CB
21:59:22Zevvgeneral rule is : don't use `add`
21:59:23disruptekadd is additive; weird stuff.
22:00:02FromGitter<deech> I thought a hash table was supposed to have unique keys.
22:00:19disruptekit does.
22:01:05FromGitter<deech> Then `Table`/`TableRef` is not a hash table?
22:01:26disrupteki think you'll find it has unique keys in any event.
22:01:59disruptekat least, to the extent of your hashing routine.
22:01:59Yardanico@deech it's still a hash table
22:02:03FromGitter<deech> I'm quite confused.
22:02:48Yardanicojust forget that this exists :P
22:03:40FromGitter<deech> I just don't understand how this is not a bug.
22:03:43*Skaruts quit (Remote host closed the connection)
22:03:52disruptekit's a feature.
22:06:19FromGitter<deech> This is nuts, this prints `("a",1) ("a", 2)`: ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5e0bc65bd5a7f357e6b3117e]
22:06:57disruptekit's cool, huh.
22:07:05FromGitter<deech> Someone who's good at hash tables help me understand this my family is dying.
22:07:42disruptektake the hash off the table and tell them to drink milk until they puke it up.
22:07:51FromGitter<deech> haha
22:07:53enthus1aststrange that strtab seems not to have this feature
22:08:06enthus1astespecially it is used for formdata
22:08:14disrupteksorta doesn't have this feature, and it makes me sad.
22:08:39FromGitter<deech> Wait people are depending on this "feature"?!
22:08:49disruptek!repo disruptek/sorta
22:08:50disbotno results 😢
22:08:59disruptekoh, 'cause it's a fork.
22:09:09disruptekwell, i have a sorta with add, if you like.
22:10:03FromGitter<deech> I'm totally going to submit this as a bug and get yelled at.
22:10:25disrupteki'm sure there are several closed issues on this.
22:10:39disruptekwhy is it so important that this feature not exist?
22:11:21FromGitter<deech> Because it is completely counter to how hash tables are supposed to work.
22:11:46disruptekit's just different to what you are used to.
22:12:10Yardanicowell, if you check the Table is basically just a sequence of tuple[hcode: Hash, key: A, val: B]
22:12:22*Hideki_ joined #nim
22:13:33FromGitter<deech> disruptek that's like saying if a set had duplicate values I'm just not used to it. The keys of a hash table should form a set.
22:17:08*Hideki_ quit (Ping timeout: 260 seconds)
22:19:13disruptekthey do.
22:20:01FromGitter<Willyboar> Happy new year from UTC+2
22:20:18disruptekhow's the future look to ya, mr. boar?
22:20:23Yardanicoit looks the same.
22:20:29Yardanico:(
22:20:42FromDiscord<Lantos> 2020 vision jokes inbound
22:20:47FromGitter<Willyboar> It's strange that i am chatting with last years disruptek
22:20:58Yardanicosteins;gate is real
22:21:00FromDiscord<Lantos> his living in the past
22:21:15disrupteki'm stuck in the past.
22:21:25disrupteki'd hardly call it livin'.
22:22:05FromDiscord<Lantos> deech are you thinking the hash table follows how an axiom of a function in math works
22:24:10FromDiscord<Lantos> it's odd, would the way you want it to work: throw a key defined error when adding a duplicate key to the hash table or overwrite the value at the key?
22:24:24Yardanico`=[]` proc works exactly as you want
22:25:37Yardanicowell, it overwrites if the keys is the same xd
22:28:38FromGitter<deech> All the references I'm finding support my intuition that duplicate keys in a hash *table* are forbidden but they do exist in a hash *map*. Here's one that makes it explicit: https://www.geeksforgeeks.org/differences-between-hashmap-and-hashtable-in-java/.
22:30:50*Kaivo quit (Ping timeout: 258 seconds)
22:31:32FromGitter<deech> In every other PL I've worked with adding a key overwrites the existing value so order of add operations matters.
22:33:07*NimBot joined #nim
22:33:07disruptekwelp, it's not going to change, so it doesn't really matter. i'd suggest making a map type and publishing it.
22:34:29FromGitter<deech> What we have now is a hash map but called a hash table.
22:35:12disruptekwhat's your proposed solution, then?
22:35:26disruptekbecause only an improvement to the situation is worthy of consideration, right?
22:36:35FromGitter<sheerluck> I actually like that Nim has that kind of Tables. For example in every other PL I've worked with dividing by zero is an exception but in Pony Lang it's just Zero. So both Nim and Pony are Special and that is nice ^_^
22:36:58Yardanicolol
22:37:02Yardanico!eval 1/0
22:37:02FromDiscord<Lantos> lol
22:37:04NimBotCompile failed: /usercode/in.nim(1, 2) Error: expression '1 / 0' is of type 'float' and has to be discarded
22:37:08Yardanico!eval echo 1/0
22:37:11NimBotinf
22:37:21Yardanico!eval echo 1.int/0.int
22:37:24NimBotinf
22:37:30FromGitter<deech> I'm not sure. A name change to hash map might be nice but it'll break a ton of stuff.
22:37:37FromDiscord<Lantos> !eval echo "im special"
22:37:40NimBotim special
22:37:43disruptekright, so that's out.
22:37:59YardanicoNimBot is very nice
22:38:19FromDiscord<Lantos> whats the gap between hash table and maps
22:38:50disruptekonly about 11cm.
22:38:56FromGitter<deech> Then docs right up top acknowledging it should be called a map but can't be changed now due to BC.
22:39:17FromDiscord<Lantos> lol
22:40:50FromGitter<deech> Maybe change `add` to `addDuplicateKey` or something like that?
22:41:01disruptekit might not be a dupe.
22:41:20FromGitter<deech> `addPossiblyDuplicateKey`
22:41:24Yardanicolol
22:41:29Yardaniconim is not C#
22:41:54Yardanicowell I mean it's too long :P
22:42:14FromGitter<deech> `addPssblyDplcteKy`
22:42:19FromDiscord<Lantos> thats what disruptek said
22:42:57*Vladar quit (Remote host closed the connection)
22:43:29*Vladar joined #nim
22:44:00FromGitter<deech> `proc add*A, B (t: var Table[A, B], key: A, val: B, duplicateIfExists = false) = ... `
22:45:07disruptekthat makes more sense, but default it to true.
22:45:11Yardanicoshould be true by default
22:45:15Yardanicodisruptek: you beat me to it :(
22:45:21FromGitter<deech> noooo! :)
22:45:30Yardanicowell, BC again :)
22:45:33disrupteklosing battle.
22:45:48FromGitter<deech> Sigh.
22:48:08FromDiscord<sealmove> Happy new year 😍
23:01:07planetis[m]Happy new year!
23:04:28*Vladar quit (Remote host closed the connection)
23:04:40FromGitter<Willyboar> Happy new year to you too planetis
23:06:01FromGitter<Willyboar> let's go to mpouzoukia
23:06:56ZevvHearts and minds people, hearts and minds!
23:07:15FromGitter<Willyboar> disruptzevv?
23:07:32FromGitter<Willyboar> or Zevvtek?
23:07:33planetis[m]alright lets get wasted
23:08:01disruptekzevv must be hitting the cough syrup pretty hard.
23:08:12planetis[m]Who got the coin this year willyboar?
23:08:32FromGitter<Willyboar> the ~/$home
23:08:34FromGitter<Willyboar> :)
23:09:06FromGitter<Willyboar> but i have 5 coins in the pie
23:09:38planetis[m]My brother
23:10:18planetis[m]Good thinking, this way none is diappointed
23:10:43planetis[m]Lots of broken tooth though
23:11:12planetis[m]I can imagine your dentist will be very happy ;)
23:11:16FromGitter<Willyboar> hahaha i have too keep all my kids happy
23:13:59*solitudesf quit (Ping timeout: 265 seconds)
23:17:10planetis[m]you're a cool father :)
23:18:37FromGitter<Willyboar> I am trying :)
23:21:18*marmotini_ joined #nim
23:22:04enthus1astcoin in pie?
23:22:18enthus1astpls enlighten a german :)
23:25:58*marmotini_ quit (Ping timeout: 260 seconds)
23:42:33*NimBot joined #nim
23:42:51Araqdeech: "addDup" would bite a bit for generic code
23:43:10Araqand most languages I looked at simply don't have an 'add' for tables
23:43:19AraqC# being the notable exception I suppose
23:43:45Araqand []= vs 'add' is perfectly clear IMHO
23:44:11AraqHAPPY NEW YEAR!
23:59:47*oprypin quit (Quit: Bye)
23:59:54*oprypin joined #nim