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:58 | muffindrake | Is 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:53 | FromGitter | <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:06 | FromGitter | <mratsim> @muffindrake you can hack together a way with func, there is a issue with the code by timotheecour |
02:02:47 | muffindrake | https://github.com/nim-lang/Nim/issues/8212 |
02:02:49 | disbot | ➥ we need a standard way to get name of procedure ; snippet at 12https://play.nim-lang.org/#ix=25Yt |
02:02:50 | muffindrake | Huh. |
02:04:09 | FromGitter | <bung87> ```code paste, see link``` ⏎ ⏎ how can I implement the pragma logic? [https://gitter.im/nim-lang/Nim?at=5e0aac99eaa2cd096fcb67aa] |
02:05:17 | FromGitter | <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:36 | shashlick | @gogolxdong - which issue? |
03:16:53 | shashlick | i considered clang originally but think it is a very heavy dependency |
03:17:05 | FromGitter | <gogolxdong> comment ast crash? |
03:17:27 | shashlick | most 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:18 | FromGitter | <gogolxdong> sure, I mean it could be a tool like c2nim. |
03:18:53 | shashlick | yes that's possible - recreating preprocessor calls in nim |
03:19:39 | FromGitter | <gogolxdong> https://github.com/eliben/llvm-clang-samples/blob/master/src_clang/tooling_sample.cpp |
03:20:16 | FromGitter | <gogolxdong> here, only if it compiles , we can modify c/c++ AST to Nim AST. |
03:20:31 | shashlick | what specific limitations are affecting you |
03:22:52 | FromGitter | <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:29 | shashlick | you want to translate C/C++ into Nim outright? |
03:23:52 | FromGitter | <gogolxdong> yes. |
03:24:18 | shashlick | okay i'm not for that, but you already know my thoughts on that |
03:24:23 | FromGitter | <gogolxdong> at least pure c project. |
03:25:10 | shashlick | why don't you like the FFI? |
03:25:43 | * | endragor joined #nim |
03:28:49 | FromGitter | <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:33 | FromGitter | <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:28 | shashlick | well, with a good wrapper and helper procs, knowledge of backend language can be minimized |
03:30:41 | shashlick | and macros can also be targeted, i have some ideas around that |
03:32:08 | FromGitter | <gogolxdong> There is also some needs to rewrite c/c++ project in Nim, not just use their FFI. |
03:33:15 | shashlick | the reason i prefer the FFI is because the upstream projects already have dedicated owners who are experts at what they are doing |
03:33:43 | shashlick | and all their efforts can be leveraged rather than translating and then maintaining a separate nim project that does the same |
03:33:53 | FromGitter | <gogolxdong> Translation is not only for better FFI, but an requirement to some extend. |
03:34:02 | * | Hideki_ joined #nim |
03:34:11 | disruptek | some days, yes, but nim is not at that point yet. |
03:34:32 | shashlick | what's a good example where a translation is a requirement? |
03:35:59 | FromGitter | <gogolxdong> We are trying to rewrite git2 to improve Merkle DAG and don't want to write any c code. |
03:37:30 | disruptek | when 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:46 | shashlick | check out disruptek's Nim project on top of nimgit2 |
03:38:56 | shashlick | !repo gittyup |
03:38:57 | disbot | https://github.com/disruptek/gittyup -- 9gittyup: 11higher-level git bindings that build upon nimgit2 15 0⭐ 0🍴 |
03:40:37 | FromGitter | <gogolxdong> Is it FFI or a translation? |
03:41:10 | shashlick | nimgit2 is wrapper over libgit2, gittyup is a Nim frontend over nimgit2 |
03:41:11 | disruptek | it's ffi. |
03:44:19 | disruptek | btw, are you sure libgit2 has everything you want in it? |
03:45:42 | FromGitter | <gogolxdong> Not sure, but aren't they the more reason to do the translation? |
03:46:03 | disruptek | what? |
03:47:32 | disruptek | i mean, i would guess that you'd want the result to include as much as possible of the finished product. |
03:47:46 | disruptek | libgit2 is not as complete a git as git is itself. |
03:47:55 | disruptek | if that makes sense... |
03:48:27 | FromGitter | <gogolxdong> sure. |
03:49:26 | FromGitter | <gogolxdong> Is the translation hard as you think? |
03:50:09 | disruptek | shashlick is probably second only to araq in terms of expertise here. |
03:50:37 | disruptek | though they favor different strategies, shashlick has wrapped many different c packages. |
03:51:19 | FromGitter | <gogolxdong> git has many features , we can just pick some to use or to improve if there was a Nim translation. |
03:51:33 | shashlick | i've not ever considered a full translation, practically speaking, even making C wrappers has been a long journey |
03:51:44 | shashlick | and i didn't deal with the preprocessor |
03:52:10 | shashlick | if you include preprocessor + full C, it will be a big undertaking |
03:52:16 | shashlick | and C is a moving target |
03:53:06 | shashlick | you might want to research other C -> X translators and see what success folks have had |
03:54:22 | FromGitter | <gogolxdong> Can I take it as hard? |
03:54:33 | disruptek | yep. |
03:54:38 | * | Hideki_ quit (Ping timeout: 260 seconds) |
03:55:09 | shashlick | I'd call it tedious more than hard |
03:55:12 | disruptek | it will be a fair amount of work. at least you don't have to invent too much stuff. |
03:55:19 | shashlick | if you have worked with ASTs before at least |
03:55:46 | shashlick | you need to understand the clang AST structure and Nim's AST if you want to use that to render Nim |
03:55:59 | shashlick | and then for every C syntax, translate one to the other |
03:56:10 | shashlick | and remember that some C may not have a Nim equivalent |
03:56:31 | FromGitter | <gogolxdong> FFI deserves disscussing all the time, we don't know which is the right thing from the perspective of future. |
03:56:54 | disruptek | you can always start with ffi and replace stuff with handwritten nim. |
03:57:07 | disruptek | that's kinda what gittyup is about. |
03:57:39 | disruptek | the name is designed to elicit this idea of accelerating the process. |
03:58:26 | shashlick | you might be better served to collaborate with disruptek |
03:58:37 | shashlick | he's already neck deep in git2 |
03:59:07 | disruptek | yeah, 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:08 | shashlick | how many resources can you dedicate to this C -> Nim effort? |
04:00:07 | FromGitter | <gogolxdong> like not much but no options? |
04:04:50 | * | zama quit (Ping timeout: 240 seconds) |
04:08:23 | FromGitter | <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:59 | disruptek | so 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:47 | disruptek | some of it is manually managed, because the c side performs allocations, while other bits are handled by nim. |
04:10:27 | shashlick | really depends on the library - sometimes it allocates and deallocates itself, other times, you need to provide an allocated buffer to use |
04:11:04 | shashlick | like 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:48 | FromGitter | <gogolxdong> Means there is potential memory safety vioaltions? |
04:15:07 | disruptek | sure. |
04:21:23 | FromGitter | <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:56 | disruptek | great, is that going to put a product in your pocket? |
04:23:44 | shashlick | i 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:54 | FromGitter | <gogolxdong> There is a balance. |
04:24:09 | shashlick | if I want to talk ssh, i'll just use libssh2 instead of trying to recreate that in nim |
04:25:00 | shashlick | and 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:33 | shashlick | but ya, if you are building a satellite or the next tesla which has life and death requirements, things can be different |
04:25:46 | shashlick | but ultimately the line is drawn in $$$ |
04:26:17 | disruptek | that's really what it comes down to. |
04:29:28 | * | zama joined #nim |
04:36:58 | FromGitter | <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:24 | FromGitter | <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:47 | FromGitter | <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:09 | Zevv | I 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:44 | Araq | there is an RFC for that but it's a terrible idea |
09:30:51 | Araq | instead use indexes |
09:31:29 | Araq | usually the slices will store redundant data like (a, b), (b+1, c), (c+1, d) |
09:31:33 | Zevv | how is it terrible? Shoudl it not be safe to have a read only view on any seq or string slice? |
09:32:34 | Araq | a borrowed pointer is more complex than an (owner, id) pair |
09:33:00 | Araq | there is a reason it took Rust a decade of research to figure this out, it's complex, indexes are simpler |
09:33:49 | Araq | and since I looked at npeg's output ... trust me, you want simpler solutions :P |
09:34:02 | Zevv | yeah, but the consumer in the end always wants to use it as a string |
09:34:05 | Zevv | tell me what's wrong |
09:34:12 | Zevv | becaue I think it is not as bad as you think it is |
09:35:05 | Araq | so create your own StringSlice type that works like that, but trust me, it's bad. |
09:35:47 | Zevv | but seriously, is anything obviously wrong with what npeg creates? |
09:36:06 | Araq | I only looked at the test's output |
09:36:25 | Araq | and most of the junk comes from unittest.nim I guess |
09:36:29 | Araq | ;-) |
09:38:23 | Araq | anyhow, here is how I do these things: |
09:38:29 | Zevv | right. 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:13 | Araq | your mistake is the ': MatchResult' |
09:39:53 | Araq | you can't reuse memory this way, you always need to construct new objects which probably contain new strings inside |
09:40:06 | Araq | so now you want to "borrow" them instead |
09:40:26 | Araq | but then the function's result depends on 'ms_NP' not going out of scope |
09:40:46 | * | solitudesf quit (Quit: Leaving) |
09:40:49 | Araq | so 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:15 | Zevv | right, that makes sense |
09:41:37 | Araq | here is what I do instead: proc parse(x: var State; tok: var Token) |
09:41:57 | Araq | and then I reuse 'tok' all the time |
09:42:16 | Araq | and then I copy the substring from the input stream indeed |
09:42:31 | Araq | but this way I can actually handle *streams*, no need for mmap crap |
09:43:06 | Araq | and my input buffer can stay at 8K all the time |
09:43:41 | Araq | and 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:19 | Zevv | Yeah, but that is *tokenizing* |
09:45:47 | Araq | yeah but ngep is for lexers |
09:45:50 | Zevv | problem is still that with parsing I need to be able to refer to stuff anywhere in the past |
09:45:56 | Zevv | Noooohoo npeg is not for lexers only :) |
09:46:21 | Araq | whatever, the principles remain |
09:46:36 | Zevv | true |
09:46:42 | * | Hideki_ joined #nim |
09:46:54 | Araq | and for ASTs use my packedjson ideas |
09:47:15 | Zevv | I never looked into that yet |
09:47:15 | Araq | actually I designed a superior IR somewhere... |
09:47:56 | Araq | but guess what, this "superior" IR also copies stuff around, the input stream is simply ill-formed for any later step |
09:50:19 | Zevv | right |
09:52:43 | Araq | also consider the locality aspects |
09:53:14 | Araq | proc constructAtom(x: sink string): Node = Node(value: x) |
09:53:17 | Araq | vs |
09:53:29 | Araq | proc constructAtom(x: string): Node = Node(value: x) |
09:54:06 | Zevv | does that make a difference with the default gc yet? |
09:54:08 | Araq | constructAtom(move token.value) # ok, but then you need to allocate the token in the next step |
09:54:45 | Araq | so both ways have overhead and you need to measure |
09:55:06 | Araq | the old GCs don't care about 'sink' |
09:55:08 | Araq | but ARC does |
09:55:15 | Araq | and yet 'sink' is not always better |
09:55:35 | Zevv | well that is where I got started yesterday, and I felt my use case would be a typical 'lent' |
09:55:47 | Zevv | I can prove the source string is still around for the lifetime of the lent slices |
09:56:04 | Araq | yeah as I said, it's an RFC away |
09:56:21 | Araq | but this RFC is particularly imprecise |
09:56:30 | Zevv | Is that the RFC that allows openArrays to be passed around as first class objects? |
09:56:34 | Araq | yes |
09:57:12 | Zevv | I expect it has a lot of surprises |
09:57:21 | Araq | of course, use 'ptr UncheckedArray[char]; length: int' and ignore what I say |
09:57:36 | Araq | Nim never really gets into your way |
09:57:57 | Zevv | ha |
09:58:26 | Zevv | I do try to pay a bit of attention of what you're saying, every now and then :) |
09:58:35 | Araq | nice |
09:59:07 | Araq | this --exceptions:goto stuff is great, I can add a .quirky pragma and we get quirky exceptions too |
09:59:19 | Araq | in the same build, for different code sections |
10:00:08 | Araq | and then I can win benchmarks without going to C++ generation :P |
10:02:15 | Araq | superb stuff |
10:04:25 | FromDiscord | <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:25 | FromDiscord | <mratsim> |
10:04:25 | FromDiscord | <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:48 | FromDiscord | <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:37 | FromDiscord | <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:05 | FromGitter | <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:55 | FromGitter | <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:01 | FromGitter | <sheerluck> In Sydney, Australia, it's 1.5 hours left to new year, and in New Zealand it's already 2020 |
11:37:18 | FromDiscord | <Clyybber> @Generic , skrylar: VCVRack probably |
11:38:06 | FromDiscord | <Clyybber> @mratsim Nice, did you switch the default back to random thief selectiom? |
11:43:41 | * | Trustable joined #nim |
11:46:34 | FromGitter | <sheerluck> 🅟 🅐 🅡 🅣 🅨 like it's the last day of Python 2! |
11:48:00 | FromGitter | <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:17 | muffindrake | According 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:17 | Zevv | according to my head 1980 is twenty years a go, and so is the year 2000 |
12:26:45 | Zevv | potje 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:23 | FromGitter | <alehander92> @xflywind use {.cached.} |
12:36:58 | FromGitter | <alehander92> like `: string {.cached.}` |
12:37:30 | FromGitter | <alehander92> proc a .. {.cached.} = |
12:37:39 | FromGitter | <alehander92> similarly to how {.async.} |
12:37:43 | FromGitter | <alehander92> is defined |
12:41:03 | FromGitter | <alehander92> @clyybber |
12:41:07 | FromGitter | <alehander92> what do you think about |
12:41:29 | FromGitter | <alehander92> @krux02 , about adding an `{.init.}` or `{.constructor.}` pragma |
12:41:32 | FromGitter | <alehander92> to types |
12:42:03 | FromGitter | <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:11 | FromGitter | <alehander92> hm probably it would be confusing |
12:42:22 | FromGitter | <alehander92> for reading .. |
13:03:13 | FromDiscord | <mratsim> @clyyber yes default is back to random |
13:03:20 | FromDiscord | <mratsim> @Clyybber* |
13:03:49 | FromDiscord | <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:15 | FromGitter | <xflywind> @alehander92 thanks. |
13:35:39 | * | endragor joined #nim |
13:40:24 | * | endragor quit (Ping timeout: 268 seconds) |
13:43:42 | FromGitter | <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:52 | FromGitter | <xflywind> we need Interceptor like this, but haven't found an elegant way. |
14:03:13 | FromGitter | <xflywind> (https://files.gitter.im/nim-lang/Nim/xR6c/QQ-Tu-Pian20191231220228.jpg) |
14:07:06 | Yardanico | what about pragmas? |
14:11:20 | FromGitter | <xflywind> how to nest pragmas? |
14:18:59 | FromGitter | <alehander92> i'd say that you have to be careful with this, you can use one pragma |
14:19:05 | FromGitter | <alehander92> which can take "arguments" |
14:19:12 | FromGitter | <alehander92> because i'd like to know that if i use such a dsl |
14:19:17 | FromGitter | <alehander92> it is relatively well optimized |
14:19:28 | FromGitter | <alehander92> i wouldnt want to have 5 nested function calls usually imho |
14:19:44 | * | Hideki_ quit (Remote host closed the connection) |
14:21:15 | FromGitter | <alehander92> so you can have something like ⏎ {.middleware: ⏎ [setMetaData, ⏎ userInterceptors( ⏎ ... [https://gitter.im/nim-lang/Nim?at=5e0b595bb3e5ce46e4a3d080] |
14:21:25 | FromGitter | <alehander92> but this is purely subjective i guess |
14:22:26 | * | Hideki_ joined #nim |
14:22:36 | * | belamenso joined #nim |
14:22:39 | FromGitter | <alehander92> of course your `decorator` macro can indeed to the same |
14:25:15 | belamenso | Hi, is this a bug in Nim that I should report, or did I misunderstood something? https://play.nim-lang.org/#ix=2611 |
14:25:57 | Yardanico | belamenso: well, I'm not sure if the code is correct, but compiler crashes are always bugs :) |
14:26:56 | FromGitter | <alehander92> yes |
14:27:04 | FromGitter | <alehander92> and in this case indeed i dont think you can just pass `g` |
14:27:08 | FromGitter | <alehander92> because when you use `|` |
14:27:16 | FromGitter | <alehander92> you get a generic ! function |
14:27:30 | FromGitter | <alehander92> so you need to somehow pass only one specialization of `g` |
14:27:43 | FromGitter | <alehander92> but indeed this needs a proper error |
14:27:56 | FromGitter | <alehander92> so it is a small actual bug indeed |
14:28:00 | belamenso | g[proc(_:int):int] g |
14:28:01 | belamenso | this works fine |
14:28:10 | FromGitter | <alehander92> ah exactly |
14:28:31 | FromGitter | <xflywind> @alehander92 oh,thanks.I'll try it. |
14:30:36 | FromGitter | <alehander92> ah not exactly belamenso not sure how it exactly works indeed .. |
14:30:39 | FromGitter | <alehander92> but you can open an issue |
14:30:44 | FromGitter | <alehander92> and wait for others there |
14:33:10 | belamenso | So 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:45 | Araq | it's one of these days ... turns out my exception handling can now handle complex cases but fails for easy cases |
14:56:26 | Yardanico | Maybe you should rest today, it's 31th december :P |
14:59:46 | oz | rest, or drink some champagne, both? |
15:01:39 | FromGitter | <zetashift> Maybe he finds working on Nim relaxing |
15:01:43 | FromGitter | <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:21 | Yardanico | lol https://github.com/belamenso/v |
15:35:36 | belamenso | Wait, I'm working on it, it's not ready |
15:35:45 | belamenso | Still has a few bugs |
15:35:54 | Yardanico | belamenso: I was just looking through latest updated nim projects :) |
15:36:00 | Yardanico | "language:nim pushed:>2019-12-28" |
15:41:32 | * | Hideki_ joined #nim |
15:47:16 | Araq | getting this test suite to be green is a pita |
15:47:50 | Yardanico | belamenso: i hope the letter `v` was ironically inspired by v language :P |
15:49:56 | belamenso | It 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:14 | belamenso | eg. you can accept 1 -------- 5 as an input to your macro, but not --------- |
15:50:25 | Yardanico | well, all code in .nim must be valid nim syntax :) |
15:50:37 | * | natrys joined #nim |
15:50:38 | belamenso | Initially I wanted to just use _, but for this reason was impossible |
15:51:03 | Yardanico | "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:28 | Araq | "can't do many interestings things with metaprogramming in Nim" omg |
15:52:43 | Araq | most hilarious statement since quite some time |
15:52:47 | muffindrake | We need a snake operator _-‾-_-‾--- |
15:52:56 | belamenso | Also 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:19 | belamenso | but if you discard it, you get exception of invalid discard since it clashes with your generated code |
15:54:01 | Araq | metaprogramming has nothing to do with syntax, look at Lisp if you don't believe me |
15:55:22 | belamenso | I do not mean "you cannot do it, it's impossible", but "you can't do it with this syntax" |
15:55:30 | belamenso | for this project the latter is more important |
15:55:56 | Araq | """ |
15:56:09 | Araq | look, custom DSL with custom tokens allowed here |
15:56:15 | Araq | """.parseAtCompileTime |
15:56:43 | Araq | still rather simple to do... |
16:03:00 | disruptek | zevv: hearts and minds! |
16:04:33 | Zevv | why *me*?! |
16:04:38 | Zevv | what did I do? |
16:04:45 | Yardanico | 👀 |
16:05:54 | disruptek | ask vixie. |
16:07:15 | * | MarquisdeFalbala joined #nim |
16:07:31 | disruptek | why am i even trying to get bump working on 0.19.6. |
16:07:48 | disruptek | shashlick is right, travis is a slave driver. |
16:10:20 | Zevv | dig what.did.I.do |
16:11:32 | * | Hideki_ quit (Remote host closed the connection) |
16:12:36 | * | Hideki_ joined #nim |
16:12:45 | FromDiscord | <Clyybber> disrtuperkt: Bearutiful: https://disruptek.github.io/gittyup/gittyup.html |
16:13:15 | disruptek | i know. never build your docs with nim 1.1.1. |
16:14:27 | disruptek | nimph canary for gc:arc: https://github.com/disruptek/nimph |
16:14:33 | disruptek | some day... |
16:15:19 | lqdev[m] | 🎵someday I'll find my peace |
16:17:42 | disruptek | zevv, you promised to make me something amazing today. |
16:20:49 | disruptek | TIL if {x} == {a,b}: |
16:20:55 | disruptek | cute. |
16:26:29 | disruptek | why is `normalizePathEnd` not exported? |
16:30:37 | * | Hideki_ quit (Remote host closed the connection) |
16:31:40 | Araq | disruptek, the stdlib is a dick |
16:32:10 | disruptek | just makes a 2-line reimpl of `lastPathPart` for 0.19.6 into a clusterfuck. |
16:32:24 | * | Hideki_ joined #nim |
16:33:54 | Araq | 0.19.6? is it 2018 once again? |
16:34:07 | disruptek | everything old is new again some day. |
16:37:23 | * | Hideki_ quit (Ping timeout: 268 seconds) |
16:43:58 | Araq | proc m = |
16:43:58 | Araq | raise newException(OSError, "Problem") |
16:43:59 | Araq | m() |
16:44:02 | Araq | # ^ works |
16:44:10 | Araq | raise newException(OSError, "Problem") |
16:44:14 | Araq | # ^ fails |
16:44:47 | Araq | probably related to my addQuitProc code... |
16:44:52 | disruptek | kinda annoying how often stuff behaves differently in global scope. |
16:45:14 | Araq | I am describing a new bug in my branch |
16:45:23 | disruptek | i know; i'm thinking of loop variables here. 😁 |
16:45:51 | * | Hideki_ joined #nim |
16:46:13 | disruptek | getCurrentProcessId 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:54 | Araq | stop messing with 0.19.6 please |
16:47:10 | Araq | it's unsupported |
16:47:22 | Araq | the point of v1 was to say "everything else is dead, enjoy" |
16:47:54 | disruptek | if that's true, it should shave a few millenia off ci tests everywhere. |
16:48:00 | FromDiscord | <Clyybber> I agree, supporting 0.19.6 seems so pointless |
16:48:07 | Araq | argh! |
16:48:13 | FromDiscord | <Clyybber> whos still using it anyways? |
16:48:19 | Araq | we destroy the current exception! |
16:48:29 | Araq | and thus it cannot raise. lol |
16:48:32 | Araq | what a bug |
16:48:41 | FromDiscord | <Clyybber> introduced by me? |
16:48:42 | * | marmotini_ joined #nim |
16:48:44 | Araq | we need a .nodestroy for globals |
16:48:47 | Araq | no, me. |
16:49:03 | FromDiscord | <Clyybber> but I started the whole destroy globals thing no? |
16:49:12 | FromDiscord | <Clyybber> hehe, latent bug |
16:49:36 | Araq | good news is that it seems to be the "last" bug so far |
16:49:43 | Araq | all the other painful tests are greening |
16:49:44 | disruptek | if it's not new, i remember a couple open issues that could be related to. |
16:49:46 | FromDiscord | <Clyybber> nice |
16:50:04 | Araq | boy this was harder than anticipated |
16:50:47 | Araq | took me 4 full days to write a new exception handling mechanism |
16:50:49 | Zevv | *except-io-nally* hard |
16:51:15 | Araq | more than the 2 days than I estimated |
16:51:17 | disruptek | araq is getting rusty. |
16:51:23 | Yardanico | oh no |
16:51:27 | Zevv | ba-dum-chhhh |
16:51:32 | Araq | :P |
16:51:42 | FromDiscord | <exelotl> anyone got simple examples of how to use the pegs module? The docs are a bit overwhelming |
16:52:50 | Araq | without the 'setjmp' the code is almost readable now |
16:53:07 | Araq | exelotl: use npegs and ask Zevv about it |
16:53:45 | * | Araq wish he could deprecate pegs.nim |
16:53:51 | Zevv | aw araq you're making me cry! |
16:54:19 | disruptek | it's ok, there's plenty of other code in the compiler that remains unreadable, zevv. |
16:54:26 | Zevv | pfew! |
16:54:32 | disruptek | 😀 |
16:56:00 | muffindrake | What part of the standard library would be best for separating command lines into arguments, with escaping spaces and the like? |
16:56:10 | disruptek | !repo cligen |
16:56:11 | disbot | https://github.com/c-blake/cligen -- 9cligen: 11Nim library to infer/generate command-line-interfaces 15 134⭐ 10🍴 7& 1 more... |
16:56:17 | Yardanico | "part of stdlib" lol |
16:56:28 | disruptek | i consider it stdlib. |
16:56:29 | Yardanico | muffindrake: https://nim-lang.org/docs/parseopt.html or parseopt2 |
16:56:36 | FromDiscord | <Clyybber> cligen is basically stdlib |
16:56:40 | Yardanico | oh parseopt2 is gone its parseopt |
16:56:42 | FromDiscord | <Clyybber> inofficial stdlib |
16:56:45 | Araq | https://nim-lang.org/docs/os.html#parseCmdLine%2Cstring |
16:57:02 | muffindrake | Thank you! |
16:57:14 | disruptek | maybe i should make araq a distribution so he can see what a bad idea it is. 😆 |
16:57:46 | Araq | you mean we need to be careful not to break important packages that are part of the distro? |
16:57:55 | Araq | ;-) |
16:58:11 | Araq | (exactly what we're doing already) |
16:58:16 | disruptek | i 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:47 | FromGitter | <deech> Aside from `option` is there a better way of doing "nil threading" in the standard library? |
17:00:48 | FromDiscord | <Clyybber> deech: Better in what sense? |
17:00:51 | FromDiscord | <Clyybber> I don't think so. |
17:01:32 | Araq | maybe use exceptions instead |
17:02:05 | * | zidsal joined #nim |
17:02:16 | disruptek | what's "nil threading"? |
17:02:41 | FromGitter | <deech> I'm just chaining together `a.option.flatMap((b) => b.something.option).flatMap((c) => c.somethingelse.option)` |
17:02:43 | Yardanico | disruptek: maybe threading as in (yarn) |
17:02:51 | Yardanico | yes, chaining basically |
17:03:42 | FromGitter | <deech> I could make a template that captures the pattern but wanted to make sure I wasn't missing something. |
17:05:58 | FromGitter | <deech> BTW I'm using this to burrow through a bunch of XML nodes. Can' t find any XPath like thing. |
17:06:15 | disruptek | no, i don't think such an animal exists yet. |
17:07:06 | disruptek | i like nim-result. i think it should be in stdlib, but perhaps with a different name. |
17:07:21 | disruptek | !package nim-result |
17:07:21 | disbot | no packages match 😢 |
17:07:24 | disruptek | !package result |
17:07:25 | disbot | https://github.com/arnetheduck/nim-result -- 9result: 11Friendly, exception-free value-or-error returns, similar to Option[T] |
17:07:42 | FromGitter | <deech> Yah, XPath is nuts. Do appreciate having an simple xml parser in the std lib. |
17:09:21 | shashlick | Wasn't status still using 0.19.6? |
17:09:41 | shashlick | Lots of when statements in nimterop for 0.19.6 |
17:10:02 | disruptek | i think they may be fully on 1.0.2 now. |
17:10:09 | FromDiscord | <mratsim> 1.0.4 |
17:10:17 | disruptek | nice. |
17:10:30 | shashlick | Oh nice - will be interesting to see if anyone else is still using it |
17:10:32 | zidsal | hi 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:55 | disruptek | s/type/YourType/ |
17:11:00 | shashlick | I'm still supporting it in my libs |
17:11:05 | disruptek | add () |
17:11:20 | shashlick | 0.19.6, 0.20.2, 1.0.4 and devel |
17:11:23 | disruptek | and you probably want it to be a var. aren't there examples of this in stdlib? |
17:11:28 | FromDiscord | <Clyybber> just ditch it |
17:11:31 | FromDiscord | <Clyybber> don't support it |
17:11:36 | * | Hideki_ quit (Remote host closed the connection) |
17:11:40 | FromDiscord | <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:47 | FromDiscord | <mratsim> what are you trying to do? |
17:12:56 | shashlick | Well at this point, it is work to remove support |
17:13:15 | shashlick | But ya, all new code I'm doing could use the smaller test surface |
17:13:43 | shashlick | Araq: I'm enjoying the compiler AST |
17:13:52 | shashlick | $nim is the way to go |
17:13:58 | disruptek | right? |
17:14:06 | FromDiscord | <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:23 | FromDiscord | <mratsim> use enums + sets |
17:14:37 | disruptek | yeah, welcome to nim, buddy. |
17:15:34 | FromDiscord | <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:44 | disruptek | how do you figure? |
17:15:58 | disruptek | you'd rather have data floating around that has no semantic value? |
17:16:00 | shashlick | I'm converting the nimterop backend to generate Nim AST which then gets rendered by compiler |
17:16:11 | FromDiscord | <mratsim> a bit salty today disruptek |
17:16:22 | disruptek | i know, sorry. i dunno what my problem is. |
17:16:26 | * | Hideki_ quit (Ping timeout: 240 seconds) |
17:16:35 | disruptek | i promise i'm not trying to be a dick. just a natural at it, i guess. |
17:16:38 | disruptek | years and years of practice. |
17:16:49 | Araq | zidsal: I would use enums too fwiw |
17:16:55 | Araq | bbl, party time here |
17:16:56 | FromDiscord | <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:11 | FromDiscord | <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:20 | disruptek | ahh, that's a new kettle of fish. |
17:17:53 | FromDiscord | <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:55 | disruptek | you need another abstraction to add new ranges, etc. |
17:17:56 | * | Hideki_ joined #nim |
17:19:35 | FromDiscord | <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:48 | FromDiscord | <mratsim> i.e. user extensible enums |
17:20:11 | FromDiscord | <zidsal> ya thats exactly what I need thanks |
17:20:19 | FromDiscord | <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:37 | FromDiscord | <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:37 | FromDiscord | <mratsim> |
17:21:37 | FromDiscord | <mratsim> A compile-time table that holds enums/identifiers |
17:21:54 | FromDiscord | <mratsim> user can register their own, and then generate it as needed |
17:21:56 | * | Hideki_ joined #nim |
17:24:50 | FromDiscord | <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:34 | FromDiscord | <zidsal> ya thats what I was planning on doing, sonly really started playing around with nim yesturday |
17:26:22 | disruptek | welcome; not all of the community is as caustic as i am, today. 😄 |
17:26:28 | * | Hideki_ quit (Ping timeout: 258 seconds) |
17:26:51 | FromDiscord | <mratsim> the challenge is finding a challenge for disruptek because he said he was bored |
17:27:30 | disruptek | it's hard finding steps short enough for stupid people. |
17:27:36 | disruptek | i have the same problem with my dog. |
17:27:46 | disruptek | so 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:56 | disruptek | and it took me three weeks of tedious demonstration. |
17:28:09 | disruptek | on the plus side, i've never been so squeaky clean. |
17:28:26 | shashlick | I think he already knew that so your efforts were likely futile |
17:28:55 | disruptek | are you saying someone got to him first? |
17:29:23 | shashlick | Some things are builtins |
17:29:36 | shashlick | Or magic |
17:29:38 | * | endragor quit (Ping timeout: 240 seconds) |
17:29:45 | disruptek | it took my dog three weeks to get tired of watching me lick myself. |
17:29:52 | disruptek | that's the basic take-away here. |
17:30:46 | shashlick | Sorry if it left a bad taste |
17:31:05 | disruptek | i'll try anything once. |
17:32:08 | FromGitter | <sheerluck> @disruptek try to implement qt5 bindings in nim please |
17:32:35 | disruptek | people aren't coding in nim because there exist no comprehensive qt5 bindings? |
17:34:35 | FromDiscord | <mratsim> they aren't coding in Nim for various reason dependig on their background: |
17:34:35 | FromDiscord | <mratsim> - not available in NPM :D |
17:34:35 | FromDiscord | <mratsim> - no repl |
17:34:35 | FromDiscord | <mratsim> - imports |
17:34:35 | FromDiscord | <mratsim> - weird case sensitivity |
17:35:04 | FromGitter | <sheerluck> @mratsim I have repl it's inim |
17:36:07 | FromDiscord | <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:19 | FromGitter | <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:50 | FromDiscord | <mratsim> you don't have to convince me but the HN and redit crowd |
17:39:44 | FromGitter | <sheerluck> well potatoes gonna potate |
17:40:06 | FromGitter | <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:52 | FromGitter | <deech> IMO a repl would be great but not essential, most aren't used to one. |
17:44:08 | FromGitter | <deech> Also could use more people doing talks on it from the context of their experience. |
17:49:00 | FromDiscord | <mratsim> it's essential for data science |
17:51:19 | FromGitter | <deech> Not my area but I believe it. |
17:55:24 | madprops | i like just walkdir, since it's short, but lately i |
17:55:30 | madprops | ve just been using whatever the autocomlete suggests |
17:55:47 | * | Hideki_ joined #nim |
17:56:09 | madprops | so walkDir probably |
17:57:40 | madprops | wouldn't a repl be trivial to implement? |
17:58:06 | madprops | oh well it would beed to store every step |
17:58:23 | madprops | and compile on each step probably |
17:58:59 | Zevv | we've seen a few people try to make it |
17:59:36 | disruptek | i could see it happening in 2020. hcr and ic are pretty unstable, but i don't think there are major technical hurdles. |
18:01:01 | disruptek | that 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:20 | FromDiscord | <Skaruts> What's the most appropriate time function for calculating a delta-time for a game? |
18:20:07 | shashlick | I use nimgrep for grepping |
18:20:57 | FromDiscord | <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:10 | FromDiscord | <Skaruts> maybe that's because I'm still on 0.20.2? |
18:22:55 | Yardanico | uh, why using an ancient nim version? :P |
18:24:11 | FromDiscord | <Skaruts> I've been away 🙂 |
18:24:59 | FromDiscord | <exelotl> trying to figure out nim-regex and it's driving me insane :( |
18:25:28 | FromDiscord | <exelotl> there's like 20 functions and none of them do what I want |
18:26:57 | FromDiscord | <exelotl> I have a line like `#define SFX_JUMP 1` and I want to get a seq with `@["SFX_JUMP", "1"]` |
18:27:18 | Yardanico | why not use split or strscans in this case? |
18:28:35 | FromDiscord | <exelotl> oh strscans seems like what I want |
18:28:43 | FromDiscord | <exelotl> thanks |
18:29:26 | * | nsf joined #nim |
18:29:32 | Zevv | and there's always npeg :) |
18:31:40 | * | aexoxea quit (Quit: Goodbye!) |
18:34:16 | FromGitter | <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:03 | Yardanico | uhh, this chain is so confusing, can you use matrix bridge? :P |
18:35:17 | Yardanico | Freenode has a matrix bridge so you can be in this IRC channel "natively" without any obvious bridges |
18:36:24 | FromGitter | <matrixbot> `grantmwilliams` im in gitter right now. clicked on the reply to name button... maybe i should avoid the UI options |
18:36:45 | Yardanico | well, I mean https://matrix.org/blog/2015/06/22/the-matrix-org-irc-bridge-now-bridges-all-of-freenode/ |
18:39:30 | FromDiscord | <Skaruts> the docs ought to mention when some feature was added |
18:40:10 | disruptek | i think there's a ticket for adding .since to `nim doc`. |
18:40:41 | FromGitter | <deech> Zevv, just used 'npeg' for some stuff and it's pretty great. |
18:42:27 | Zevv | sweet, good to hear that |
18:43:00 | FromGitter | <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:18 | FromGitter | <deech> Also '-d:npegDumpDot` seems to have no effect. |
18:45:22 | Zevv | something 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:44 | Zevv | oh is dot broken, will look at that. I never use that myself and there is no test for it I guess |
18:46:14 | FromGitter | <deech> Ok, def. not worth additional complexity just a nice-to-have if it's easy. |
18:46:20 | disruptek | i think it's out-of-scope to do the json construction. |
18:46:38 | * | rockcavera quit (Remote host closed the connection) |
18:47:14 | Zevv | well, that was legicy. before there were code block captures npeg could only capture to json objects |
18:47:17 | Zevv | but that was a mistake |
18:47:39 | Zevv | i just used that because it is a proven object type to store complex structured data |
18:47:46 | FromGitter | <matrixbot> `grantmwilliams` Do the Nim docs link to source code anywhere? |
18:48:01 | FromGitter | <deech> Why not a hash table? |
18:48:33 | Zevv | just seemed like a good idea at that time |
18:48:39 | FromGitter | <matrixbot> `grantmwilliams` nevermind im extremely dumb. i spelled source wrong *face palm* |
18:50:33 | FromGitter | <phillvancejr> why doesn't this work? |
18:50:36 | FromGitter | <deech> Is `ref ..` the last remaining place in Nim where `nil` can occur? |
18:50:58 | FromGitter | <deech> Aside from C pointers, ofc. |
18:51:57 | disruptek | interesting question. |
18:53:14 | Zevv | deech: dot works, but the README is wrong in one place: use -d:npegDotDir=. instead |
18:53:29 | FromDiscord | <Clyybber> deech: Yes, only pointers and refs can be nil, |
18:53:46 | FromGitter | <deech> Cool, will try that. Was it putting it in `/tmp` or something before? |
18:54:11 | Zevv | where you point it, so -d:npegDotDir=/tmp should work |
18:54:37 | FromGitter | <deech> I meant when I didn't specify that before did it default to some other location |
18:54:53 | Zevv | oh I think it was always like this? |
18:55:08 | FromGitter | <deech> Cool, thanks! |
18:55:27 | FromGitter | <deech> Re: `ref` and `nil` that's great. |
18:55:47 | * | Skaruts joined #nim |
18:56:12 | disruptek | -d:foo=bar syntax was only supported on the cli until recently. |
18:56:27 | disruptek | nim.cfg syntax is -d:foo="bar" actually. |
18:56:54 | FromDiscord | <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:09 | disruptek | yeah, you have to code around it. |
18:57:36 | FromDiscord | <Skaruts> I don't know what it means |
18:58:37 | Skaruts | I had it before but I can't remember what it was about... |
18:59:45 | Skaruts | maybe this part is relevant too? |
18:59:51 | Skaruts | `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:09 | FromDiscord | <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:03 | Skaruts | forgot to install minGW that's what it was... :S |
19:29:12 | Skaruts | all good now |
19:48:46 | FromGitter | <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:26 | FromGitter | <deech> What does the `<//>` syntax mean here? `proc newTable*[A, B](initialSize = defaultInitialSize): <//>TableRef[A, B] = ...` |
20:17:49 | disruptek | it's a placeholder for owned in pre-owned code. |
20:19:06 | FromGitter | <deech> Can you link to any docs? I can't seem to find it here: https://nim-lang.org/araq/ownedrefs.html. |
20:19:27 | disruptek | it's an artifact of the impl afaik; don't sweat it. |
20:20:35 | FromGitter | <deech> Thanks! |
20:21:02 | disruptek | sorry there isn't more to offer there. 😉 |
20:23:42 | shashlick | @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:38 | FromGitter | <deech> Ok one more. :) What's the difference between `do:` and `block:` outside of a macro's `quote do:` context? |
20:25:58 | FromGitter | <deech> I'm guessing `block:` has to return a value and `do:` doesn't? |
20:28:02 | Araq | there is a verv different parsing rule involved |
20:28:04 | Araq | you can do |
20:28:06 | Araq | foobar: |
20:28:11 | Araq | echo "section A" |
20:28:13 | Araq | do: |
20:28:16 | Araq | echo "section B" |
20:28:23 | Araq | and it's all passed to 'foobar' |
20:28:28 | Araq | block cannot do this |
20:28:53 | Araq | later on we figured we don't need 'do'... and it's an unloved child ever since |
20:30:16 | FromGitter | <deech> A bunch of the standard lib docs still use `do:`. |
20:30:35 | FromGitter | <deech> `withValue` in `tables` is an example. |
20:31:42 | FromGitter | <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:44 | Araq | yes, 'quote do' also comes to mind |
20:33:08 | Araq | and please don't misunderstand me |
20:33:25 | Araq | 'do' is required and cannot be replaced with 'block' |
20:33:41 | Araq | it's just that there are alternative, better API designs solving the same problem |
20:33:54 | Araq | for example |
20:34:53 | Araq | table.tryGetValue(key): |
20:35:04 | Araq | hasValue(val): |
20:35:07 | Araq | noValue: |
20:35:25 | Araq | more indentation and subsections are easier to read |
20:37:50 | Araq | er, Clyybber |
20:37:59 | Araq | destroying thread local vars seems wrong to me |
20:38:13 | Araq | if we only destroy them for the main thread anyway |
21:04:24 | * | nsf quit (Quit: WeeChat 2.6) |
21:10:04 | FromGitter | <sheerluck> btw happy new year 2020 |
21:16:00 | enthus1ast | can someone unlock the new forum user Dankrad please :) |
21:20:30 | FromDiscord | <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:30 | FromDiscord | <Lantos> script(src="..blah.js" defer) |
21:20:44 | FromDiscord | <Lantos> window vars* |
21:22:36 | FromDiscord | <Skaruts> how am I getting an order of magnitude discrepancy here? Both calculations are the exact same: |
21:22:51 | FromDiscord | <Skaruts> `dt = float64(getMonoTime().ticks-t) / 1000000.0` |
21:22:55 | FromDiscord | <Skaruts> `echo dt, " | ", float64(getMonoTime().ticks-t) / 1000000.0 #>>> 0.001136 | 0.014484` |
21:34:31 | * | mal`` quit (Quit: Leaving) |
21:45:49 | FromDiscord | <Milerius> happy new year everyone :p |
21:49:11 | FromDiscord | <Lantos> Happy New year! |
21:49:14 | Yardanico | you 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:41 | FromGitter | <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:10 | Zevv | nope |
21:58:30 | Zevv | this comes up every so often and is a big surprise to everyone who finds out |
21:58:39 | FromGitter | <deech> I'm surprised. |
21:58:46 | Zevv | I said so :) |
21:58:54 | disruptek | i can't read gitter; is it the multi-value thing? |
21:58:58 | FromGitter | <deech> Not even my birthday. |
21:59:04 | Zevv | Did you read the manual? Because then you would not be surprised |
21:59:06 | Zevv | https://nim-lang.github.io/Nim/tables.html#add%2CTable%5BA%2CB%5D%2CA%2CB |
21:59:22 | Zevv | general rule is : don't use `add` |
21:59:23 | disruptek | add is additive; weird stuff. |
22:00:02 | FromGitter | <deech> I thought a hash table was supposed to have unique keys. |
22:00:19 | disruptek | it does. |
22:01:05 | FromGitter | <deech> Then `Table`/`TableRef` is not a hash table? |
22:01:26 | disruptek | i think you'll find it has unique keys in any event. |
22:01:59 | disruptek | at least, to the extent of your hashing routine. |
22:01:59 | Yardanico | @deech it's still a hash table |
22:02:03 | FromGitter | <deech> I'm quite confused. |
22:02:48 | Yardanico | just forget that this exists :P |
22:03:40 | FromGitter | <deech> I just don't understand how this is not a bug. |
22:03:43 | * | Skaruts quit (Remote host closed the connection) |
22:03:52 | disruptek | it's a feature. |
22:06:19 | FromGitter | <deech> This is nuts, this prints `("a",1) ("a", 2)`: ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5e0bc65bd5a7f357e6b3117e] |
22:06:57 | disruptek | it's cool, huh. |
22:07:05 | FromGitter | <deech> Someone who's good at hash tables help me understand this my family is dying. |
22:07:42 | disruptek | take the hash off the table and tell them to drink milk until they puke it up. |
22:07:51 | FromGitter | <deech> haha |
22:07:53 | enthus1ast | strange that strtab seems not to have this feature |
22:08:06 | enthus1ast | especially it is used for formdata |
22:08:14 | disruptek | sorta doesn't have this feature, and it makes me sad. |
22:08:39 | FromGitter | <deech> Wait people are depending on this "feature"?! |
22:08:49 | disruptek | !repo disruptek/sorta |
22:08:50 | disbot | no results 😢 |
22:08:59 | disruptek | oh, 'cause it's a fork. |
22:09:09 | disruptek | well, i have a sorta with add, if you like. |
22:10:03 | FromGitter | <deech> I'm totally going to submit this as a bug and get yelled at. |
22:10:25 | disruptek | i'm sure there are several closed issues on this. |
22:10:39 | disruptek | why is it so important that this feature not exist? |
22:11:21 | FromGitter | <deech> Because it is completely counter to how hash tables are supposed to work. |
22:11:46 | disruptek | it's just different to what you are used to. |
22:12:10 | Yardanico | well, 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:33 | FromGitter | <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:13 | disruptek | they do. |
22:20:01 | FromGitter | <Willyboar> Happy new year from UTC+2 |
22:20:18 | disruptek | how's the future look to ya, mr. boar? |
22:20:23 | Yardanico | it looks the same. |
22:20:29 | Yardanico | :( |
22:20:42 | FromDiscord | <Lantos> 2020 vision jokes inbound |
22:20:47 | FromGitter | <Willyboar> It's strange that i am chatting with last years disruptek |
22:20:58 | Yardanico | steins;gate is real |
22:21:00 | FromDiscord | <Lantos> his living in the past |
22:21:15 | disruptek | i'm stuck in the past. |
22:21:25 | disruptek | i'd hardly call it livin'. |
22:22:05 | FromDiscord | <Lantos> deech are you thinking the hash table follows how an axiom of a function in math works |
22:24:10 | FromDiscord | <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:24 | Yardanico | `=[]` proc works exactly as you want |
22:25:37 | Yardanico | well, it overwrites if the keys is the same xd |
22:28:38 | FromGitter | <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:32 | FromGitter | <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:07 | disruptek | welp, it's not going to change, so it doesn't really matter. i'd suggest making a map type and publishing it. |
22:34:29 | FromGitter | <deech> What we have now is a hash map but called a hash table. |
22:35:12 | disruptek | what's your proposed solution, then? |
22:35:26 | disruptek | because only an improvement to the situation is worthy of consideration, right? |
22:36:35 | FromGitter | <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:58 | Yardanico | lol |
22:37:02 | Yardanico | !eval 1/0 |
22:37:02 | FromDiscord | <Lantos> lol |
22:37:04 | NimBot | Compile failed: /usercode/in.nim(1, 2) Error: expression '1 / 0' is of type 'float' and has to be discarded |
22:37:08 | Yardanico | !eval echo 1/0 |
22:37:11 | NimBot | inf |
22:37:21 | Yardanico | !eval echo 1.int/0.int |
22:37:24 | NimBot | inf |
22:37:30 | FromGitter | <deech> I'm not sure. A name change to hash map might be nice but it'll break a ton of stuff. |
22:37:37 | FromDiscord | <Lantos> !eval echo "im special" |
22:37:40 | NimBot | im special |
22:37:43 | disruptek | right, so that's out. |
22:37:59 | Yardanico | NimBot is very nice |
22:38:19 | FromDiscord | <Lantos> whats the gap between hash table and maps |
22:38:50 | disruptek | only about 11cm. |
22:38:56 | FromGitter | <deech> Then docs right up top acknowledging it should be called a map but can't be changed now due to BC. |
22:39:17 | FromDiscord | <Lantos> lol |
22:40:50 | FromGitter | <deech> Maybe change `add` to `addDuplicateKey` or something like that? |
22:41:01 | disruptek | it might not be a dupe. |
22:41:20 | FromGitter | <deech> `addPossiblyDuplicateKey` |
22:41:24 | Yardanico | lol |
22:41:29 | Yardanico | nim is not C# |
22:41:54 | Yardanico | well I mean it's too long :P |
22:42:14 | FromGitter | <deech> `addPssblyDplcteKy` |
22:42:19 | FromDiscord | <Lantos> thats what disruptek said |
22:42:57 | * | Vladar quit (Remote host closed the connection) |
22:43:29 | * | Vladar joined #nim |
22:44:00 | FromGitter | <deech> `proc add*A, B (t: var Table[A, B], key: A, val: B, duplicateIfExists = false) = ... ` |
22:45:07 | disruptek | that makes more sense, but default it to true. |
22:45:11 | Yardanico | should be true by default |
22:45:15 | Yardanico | disruptek: you beat me to it :( |
22:45:21 | FromGitter | <deech> noooo! :) |
22:45:30 | Yardanico | well, BC again :) |
22:45:33 | disruptek | losing battle. |
22:45:48 | FromGitter | <deech> Sigh. |
22:48:08 | FromDiscord | <sealmove> Happy new year 😍 |
23:01:07 | planetis[m] | Happy new year! |
23:04:28 | * | Vladar quit (Remote host closed the connection) |
23:04:40 | FromGitter | <Willyboar> Happy new year to you too planetis |
23:06:01 | FromGitter | <Willyboar> let's go to mpouzoukia |
23:06:56 | Zevv | Hearts and minds people, hearts and minds! |
23:07:15 | FromGitter | <Willyboar> disruptzevv? |
23:07:32 | FromGitter | <Willyboar> or Zevvtek? |
23:07:33 | planetis[m] | alright lets get wasted |
23:08:01 | disruptek | zevv must be hitting the cough syrup pretty hard. |
23:08:12 | planetis[m] | Who got the coin this year willyboar? |
23:08:32 | FromGitter | <Willyboar> the ~/$home |
23:08:34 | FromGitter | <Willyboar> :) |
23:09:06 | FromGitter | <Willyboar> but i have 5 coins in the pie |
23:09:38 | planetis[m] | My brother |
23:10:18 | planetis[m] | Good thinking, this way none is diappointed |
23:10:43 | planetis[m] | Lots of broken tooth though |
23:11:12 | planetis[m] | I can imagine your dentist will be very happy ;) |
23:11:16 | FromGitter | <Willyboar> hahaha i have too keep all my kids happy |
23:13:59 | * | solitudesf quit (Ping timeout: 265 seconds) |
23:17:10 | planetis[m] | you're a cool father :) |
23:18:37 | FromGitter | <Willyboar> I am trying :) |
23:21:18 | * | marmotini_ joined #nim |
23:22:04 | enthus1ast | coin in pie? |
23:22:18 | enthus1ast | pls enlighten a german :) |
23:25:58 | * | marmotini_ quit (Ping timeout: 260 seconds) |
23:42:33 | * | NimBot joined #nim |
23:42:51 | Araq | deech: "addDup" would bite a bit for generic code |
23:43:10 | Araq | and most languages I looked at simply don't have an 'add' for tables |
23:43:19 | Araq | C# being the notable exception I suppose |
23:43:45 | Araq | and []= vs 'add' is perfectly clear IMHO |
23:44:11 | Araq | HAPPY NEW YEAR! |
23:59:47 | * | oprypin quit (Quit: Bye) |
23:59:54 | * | oprypin joined #nim |