00:03:32 | rayman22201 | @exelotl? |
00:04:12 | FromDiscord_ | <exelotl> wow, yeah that works! |
00:04:22 | rayman22201 | sweet! |
00:04:22 | FromDiscord_ | <exelotl> but I'm sure I tried so many things that were so close to this |
00:05:57 | rayman22201 | hrmmm. idk. I'm happy to know that Nim is actually smart after all when it comes to this stuff :-P |
00:06:31 | FromDiscord_ | <exelotl> I think it's just that I was trying to put it in a let variable because I assumed const would always be 'substituted' in the place where you use it (like how it is with strings) |
00:06:48 | FromDiscord_ | <moerm> @rayman Cool solution. Did you actually look at the C code generated? |
00:07:00 | rayman22201 | I did indeed look at the C to verify. |
00:07:06 | rayman22201 | it does the right thing |
00:07:12 | FromDiscord_ | <moerm> Nice. Well done! |
00:08:22 | rayman22201 | Yeah, you can't rely on let always going to const. Let has slightly different semantics than true C const. This allows Nim some leeway with optimizations, but you can't rely on it. |
00:08:39 | FromDiscord_ | <moerm> @exelotl Nope. Let is a) "immutable" and b (and de facto) a hint to the compiler (SSA) as I understand it. So let is *not* just another "const" |
00:10:05 | rayman22201 | arguably that is another tip that should go into the docs or faq. People seem to get this confused too often.... hrmmm |
00:11:05 | FromDiscord_ | <moerm> Yes. let should be considered as a "use once var". clang, in particular is quite good on making use of that |
00:11:31 | FromDiscord_ | <exelotl> the thing is, I would possibly like to get the address of the generated data (e.g. fast memcpy some graphics into video memory) |
00:11:45 | FromDiscord_ | <moerm> Many though see it as a "const whose value I don't know at compile time" - which it is not |
00:12:33 | FromDiscord_ | <exelotl> oh it is possible! |
00:12:55 | FromDiscord_ | <exelotl> just has to be done in a function scope |
00:13:14 | FromDiscord_ | <moerm> Funny day here with quite some interesting questions. We know that Nim doesn't like to hand out "let" addresses (but does if you insist via unsafeAddr). But the address of a const is something I never looked at |
00:15:14 | FromDiscord_ | <exelotl> so basically this works: https://hastebin.com/raw/ijuhavutil |
00:15:40 | FromDiscord_ | <exelotl> but not if you don't wrap it in a main proc |
00:16:01 | FromDiscord_ | <exelotl> (with --os:standalone --gc:none) |
00:16:24 | FromDiscord_ | <moerm> does it really? Your ``c`` is a pointer |
00:16:51 | FromDiscord_ | <exelotl> yeah, nim dereferences for you |
00:18:17 | FromDiscord_ | <exelotl> but the generated code isn't good though, because it copies a into b |
00:20:33 | FromDiscord_ | <exelotl> maybe I could write some cursed C macro to do it, though it would be super unsafe |
00:20:33 | * | zyklon quit (Read error: Connection reset by peer) |
00:20:43 | rayman22201 | hrmmm. thinking about it |
00:21:44 | rayman22201 | Yeah, what you did doesn't really do what you want. C is the address of b, which was a local copy made of a. |
00:25:54 | * | theelous3 joined #nim |
00:30:11 | FromGitter | <timotheecour> if anyone wants to finally pass below the bar of 1400 issues, https://github.com/nim-lang/Nim/pull/10141 is up for review |
00:30:46 | FromDiscord_ | <exelotl> rayman: this does the trick! https://hastebin.com/raw/birafabaza >:) |
00:31:42 | rayman22201 | exelotl very nice! |
00:32:03 | FromDiscord_ | <exelotl> in fact you can just do this: proc GetAddr():pointer {.varargs, importc:"&", nodecl.} |
00:32:16 | rayman22201 | that is a "use with great caution" function though lol |
00:32:23 | FromDiscord_ | <exelotl> lmao yes it is xD |
00:32:54 | FromDiscord_ | <exelotl> `uberUnsafeAddr` |
00:33:04 | rayman22201 | lol. yes. basically |
00:33:50 | FromDiscord_ | <exelotl> idk if there's a more proper way to do it than varargs |
00:34:14 | FromDiscord_ | <exelotl> but it was the easiest way I could see to bind a function that takes anything |
00:34:29 | rayman22201 | You have to be aware that depending on what the const is, it might just end up being copied into the program and won't actually have an address. |
00:34:39 | rayman22201 | I think varargs is correct here |
00:38:12 | * | zyklon joined #nim |
00:43:47 | * | Ven`` quit (Ping timeout: 258 seconds) |
00:58:47 | * | Tyresc quit (Quit: WeeChat 2.4-dev) |
00:58:47 | * | abm quit (Ping timeout: 240 seconds) |
01:06:32 | * | d10n-work quit (Quit: Connection closed for inactivity) |
01:34:41 | * | leorize joined #nim |
01:37:09 | * | zachk quit (Read error: Connection reset by peer) |
01:45:20 | * | zyklon quit (Ping timeout: 250 seconds) |
01:59:52 | * | zyklon joined #nim |
02:02:45 | * | theelous3 quit (Ping timeout: 258 seconds) |
02:17:45 | FromGitter | <kaushalmodi> @timotheecour It crazy seeing how many bugs you fix almost every day. Keep up the work! I cannot fathom how to comfortav |
02:18:03 | FromGitter | <kaushalmodi> *comfortably touch and fix so many different parts of Nim |
02:19:22 | FromGitter | <timotheecour> really happy to hear some people appreciate it, thanks! I also apperciate your work btw :) |
02:22:49 | FromGitter | <timotheecour> I think the *number 1* thing nim needs is a fast pace PR/review/fix/merge cycle. That’ll encourage more ppl to send PR’s, or rather not discourage ppl who have PR’s |
02:43:23 | FromGitter | <arnetheduck> sounds like a reason not to use `devel` - testing other peoples quantity-over-quality patches.. |
02:44:22 | * | Marumoto joined #nim |
02:45:39 | FromGitter | <kaushalmodi> @arnetheduck What are you referring to> |
02:45:57 | FromGitter | <arnetheduck> fast pace merge-and-fix cycle |
02:46:17 | FromGitter | <kaushalmodi> fast doesn't mean "quantity over quality" |
02:46:28 | FromGitter | <kaushalmodi> look at the last commit by @timotheecour |
02:46:29 | * | zyklon quit (Read error: Connection reset by peer) |
02:46:34 | FromGitter | <kaushalmodi> he makes exemplary commits |
02:46:40 | FromGitter | <kaushalmodi> fix + test cases |
02:46:43 | FromGitter | <kaushalmodi> https://github.com/nim-lang/Nim/commit/6ce3949c8aa489d268f272829d03edab175bfc7a |
02:47:17 | FromGitter | <kaushalmodi> fast means reducing the PR queue, and committing them as soon as someone reviews them and approves them |
02:49:59 | FromGitter | <timotheecour> @arnetheduck I have to disagree. That’s what stable is for. As for quantity of quality, that’s subjective. So long stable is, well, stable, and devel has good CI (including planned nimble-wide CI) as a sanity check, I much prefer the occasional breakage-on-devel than having PR’s languishing forever waiting for review comments. Note that slower reviews doesn’t mean higher quality at all, it just means |
02:49:59 | FromGitter | ... PR’s are waiting for reviewer for comments or a merge (only referring to ones that are green+all comments addressed, if any) |
02:52:35 | shashlick | for those online - do you know how to raise exceptions that can be caught at CT / nimscript |
02:53:05 | shashlick | i'm getting EOFError for stdin.readAll() but it cannot be caught in a nims file |
02:53:39 | shashlick | if i catch it in scriptconfig.nim then there's no way to inform consumer that EOF has occurrsed |
02:54:38 | FromGitter | <timotheecour> this is relevant: https://github.com/nim-lang/Nim/commit/cfbf9dcc597a1465c106975f506e7f6221bb99e6 |
02:54:45 | FromGitter | <arnetheduck> didn't say anything different.. merely that it's incentive to stay off devel / many people presently use devel get affected when the churn rate is high.. also, a pr that doesn't immediately feel so good that you want to press the merge button generally might be good locally but not fit the grander scheme of things and might need a bit of thought |
02:56:18 | shashlick | @timotheecour: i saw that but don't think that's relevant |
02:56:29 | shashlick | perhaps it still fails in nim e file.nims case |
02:56:42 | Marumoto | Does nim idetools work? |
02:56:55 | leorize | nim idetools is deprecated |
02:56:57 | FromGitter | <zetashift> Isn't it natural if Nim grows that the PR/issues flow gets messier? I think it's a good strategy at handling them is needed but not sure if it's the number 1 thing Nim needs :P |
02:57:03 | leorize | Marumoto: the replacement tool is nimsuggest |
02:57:03 | FromGitter | <timotheecour> if a PR doesn’t feel so good, write a comment as to why it doesn’t feel so good. What shouldn’t happen is days with no review comments and no merge whatsoever. |
02:57:06 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
02:59:54 | FromGitter | <timotheecour> @shashlick I’ve had a similar issue with try `switch(“something_new", "10”) except: discard` in which exception is thrown but not caught |
03:00:28 | FromGitter | <timotheecour> (in nimscript); i was hoping that commit could be adapted to help w ur case, but idk |
03:00:31 | shashlick | nope - even at CT it fails |
03:00:34 | shashlick | ..\lib\system.nim(2997) sysFatal |
03:00:35 | shashlick | Error: unhandled exception: EOF reached [EOFError] |
03:00:35 | * | banc quit (Quit: Bye) |
03:00:41 | FromGitter | <zetashift> I think I read that D even did a fundraiser for a PR maintainer, however with limited resources things are hard |
03:00:42 | shashlick | not able to catch it, base or specific class |
03:00:42 | * | theelous3_ joined #nim |
03:01:56 | shashlick | http://ix.io/1xRu - i've added a new proc to scriptconfig.nim but cannot catch EOFError when raised |
03:02:35 | FromGitter | <timotheecour> open a bug :) |
03:02:36 | shashlick | if i catch it in scriptconfig.nim, i cannot convey to the user that there's nothing left since you could have a blank line read |
03:02:45 | shashlick | but is it a bug? |
03:03:22 | leorize | I think it's a bug |
03:04:22 | * | zyklon joined #nim |
03:04:26 | shashlick | so if EOFError is raised in the VM, i should be able to catch it in nimscript? |
03:04:47 | shashlick | cbconf readAllFromStdin: |
03:04:48 | shashlick | setResult(a, stdin.readAll()) |
03:04:49 | FromGitter | <timotheecour> yes, see https://github.com/nim-lang/Nim/issues/8740 |
03:04:54 | shashlick | that's what i've added to it |
03:07:30 | FromGitter | <arnetheduck> well, I know from experience that can be hard sometimes, because the asymmetry of the return on a small fix vs the amount of thinking it takes to explain why it's bad.. in part, git is distributed so that people can work at their own pace - that's what the whole pull model is about - you generally shouldn't be hindered by the fact that upstream hasn't pulled your request, you can keep working on your own branch - |
03:07:30 | FromGitter | ... there are really two outcomes here: your patch will get merged because it's good, or it won't.. if you don't believe in your patch enough that you're unwilling to base subsequent work on it, it's generally not a good sign either |
03:09:27 | shashlick | well i've made it a habit to check with the module owner before even starting to work on something |
03:10:05 | shashlick | i've been demotivated when PRs sit around too |
03:10:21 | shashlick | so i make it a point to evangelize before doing any work |
03:10:42 | shashlick | second, i make my PRs as simple as possible |
03:10:50 | shashlick | that way reviews are easier on the eyes |
03:11:02 | shashlick | of course that means i cannot do big refactors but such is life |
03:11:06 | FromGitter | <arnetheduck> shashlick, yeah, that's a good one also - grounding the work before you start is an excellent way to start the thought process before the patch lands, so that when it lands, it's easy to review - though for small fixes, it's usually over the top |
03:11:57 | shashlick | well unfortunately, reviewers are quite picky so i have become very cautious with how i use my time |
03:12:51 | FromGitter | <timotheecour> the problem of nim is not too many contributors and too fast pace; it’s too few contributors. In companies such as google/facebook, code evolves at a much higher pace; in part because it’s 1 mono-repo, but more importantly because of 1: delegation and 2: review process is much more efficient. |
03:14:54 | FromGitter | <arnetheduck> how many employees does google have, again? or even better - how many people does google have that write down rules for the review process, analyzing it in minute detail? what's the return on that kind of work, in a very small project? |
03:17:01 | * | banc joined #nim |
03:17:02 | * | zyklon quit (Read error: Connection reset by peer) |
03:17:51 | shashlick | okay this EOFError thing isn't an issue - need to handle it in nimscript.nim like OSError is |
03:19:27 | FromGitter | <timotheecour> Lots of projects are actually staffed by small teams actually, but everyone gets strong ownership based on their skill level/past experience which allows delegation to work, whether it’s small scale or large scale. They’re facing a much bigger problem in fact (different languages, complex depenencies bw projects including ones that are tied to ads and cannot ever go down). Yet, there’s never been a “slow is |
03:19:27 | FromGitter | ... better/safer” attitude |
03:19:48 | * | theelous3_ quit (Read error: Connection reset by peer) |
03:19:53 | shashlick | I think nim is too big and very few people have wide experience |
03:20:11 | shashlick | i should start reviewing PRs but not in a position to merge |
03:20:42 | FromGitter | <timotheecour> review comments on any PR are always welcome |
03:22:43 | FromGitter | <arnetheduck> ah, now we're talking.. delegation, sure - better guidelines (whether through well-established culture or written rules), sure.. but "faster" as an explicit objective? sounds like attacking the symptom, not the cause |
03:25:16 | FromGitter | <timotheecour> actually I’d be all in favor of guidelines. I never care about style issues (because that’s what tooling eg nimpretty / `--styleCheck:on` is for) but some ppl seem to care, so their decisions should be in a document (OR , better, in a linter, so it’s automated away from PR review); stuff like: block comments vs doc comments for eg. |
03:26:21 | FromGitter | <timotheecour> edit: I never care : so long that rule wasn’t already written down, in which case i just follow it. |
03:28:31 | FromGitter | <timotheecour> and yes, faster is essential. It makes difference bw attracting new repeat contributors vs turning them away in future after a couple bad experiences. Faster doesn’t mean less quality, I have 0 complaint about good review nits/feedbacks. |
03:33:57 | * | zyklon joined #nim |
03:38:19 | FromGitter | <arnetheduck> well, technically it only turns away the category of contributors that demand real-time attention and can't adapt.. only you control whether you get discouraged or demotivated by your patch not immediately receiving feedback, nobody else. |
03:40:30 | * | endragor joined #nim |
03:41:16 | FromGitter | <arnetheduck> so just to be clear, I generally agree that short reviews times are a sign of good health in a project and a good thing for everyone involved, but it's a correlation, not a causation, as far as I'm concerned... |
03:42:43 | shashlick | well, fact is that very few people have wide knowledge of the nim codebase which is huge |
03:43:34 | shashlick | i disagree though - if my patch sits around for weeks, i myself forget what it was and might even lose the test setup in the interim |
03:44:56 | * | endragor quit (Ping timeout: 250 seconds) |
03:47:07 | FromGitter | <timotheecour> yes, that leads to fragmentation; I have > 150 active local branches in Nim repo, because each branch is 1 PR and each PR should remain focused on 1 fix. slow PR cycle makes it hard; not that araq doesn’t have that problem since he’s not working from PR’s so that rule doesn’t apply to him and he’s able to do larger refactorings ; (not saying that’s a bad thing btw, whatever makes him more efficient is |
03:47:07 | FromGitter | ... good) |
03:48:09 | leorize | we need more core devs to review PRs, that is |
03:48:55 | leorize | the bad thing is only Araq know enough about the compiler to review PRs related to it. |
03:50:24 | shashlick | that's my state - i can merge but easier said than done |
03:55:18 | FromGitter | <timotheecour> 1 concrete step I’d like us to adopt that could speed things up a lot: ⏎ a reviewer sends LGTM with a note on minor nits; the PR author is expected and trusted to address those nits and the PR can be merged without further review needed. Instead of adding 1 more layer of back and forth. reviewer discretion is used as to what’s a minor nit. |
03:55:28 | * | nsf joined #nim |
03:56:29 | * | darithorn joined #nim |
03:56:43 | FromGitter | <arnetheduck> well, comparatively, the nim codebase is not that big, really.. it's a bit tangled though, so it's easy to mess up a completely unrelated part / you need to know a large percentage of it to be efficient |
04:20:14 | * | endragor joined #nim |
04:24:33 | * | endragor quit (Ping timeout: 244 seconds) |
04:33:46 | * | vlad1777d_ quit (Ping timeout: 246 seconds) |
04:43:52 | * | dddddd quit (Ping timeout: 250 seconds) |
04:53:09 | * | Marumoto1 joined #nim |
04:56:37 | * | avsej_ joined #nim |
04:56:37 | * | avsej_ quit (Changing host) |
04:56:38 | * | avsej_ joined #nim |
05:02:09 | * | zyklon quit (*.net *.split) |
05:02:09 | * | Marumoto quit (*.net *.split) |
05:02:09 | * | avsej quit (*.net *.split) |
05:02:09 | * | synthmeat quit (*.net *.split) |
05:02:09 | * | Geezus42 quit (*.net *.split) |
05:02:09 | * | Jesin quit (*.net *.split) |
05:02:09 | * | ofelas quit (*.net *.split) |
05:02:09 | * | avsej_ is now known as avsej |
05:04:17 | * | Geezus42 joined #nim |
05:08:25 | * | Jesin joined #nim |
05:08:59 | * | ofelas joined #nim |
05:09:19 | * | zyklon joined #nim |
05:09:58 | * | synthmeat joined #nim |
05:17:15 | * | leorize quit (Quit: WeeChat 2.3) |
05:33:10 | * | krux02 joined #nim |
05:43:49 | * | narimiran joined #nim |
05:44:54 | * | Marumoto1 quit (Quit: Leaving) |
05:46:43 | * | BigEpsilon joined #nim |
06:36:33 | * | darithorn quit (Quit: Leaving) |
06:43:02 | * | BigEpsilon quit (Ping timeout: 250 seconds) |
06:48:46 | * | leorize joined #nim |
07:05:25 | Araq | others can also merge compiler PRs but they tend to be more busy. And many PRs that I am asked to review have rather obvious issues. It's like "the CIs are green, must be good code, merge it already" |
07:06:12 | Araq | Others don't even keep the CIs green. |
07:08:21 | * | absolutejam joined #nim |
07:08:33 | absolutejam | morning all |
07:09:11 | absolutejam | is there any functionality like python's prompt-toolkit? |
07:10:56 | absolutejam | want to create an interactive shell for my app |
07:11:00 | FromGitter | <timotheecour> i only know of https://github.com/h3rald/nimline in that category |
07:11:44 | absolutejam | I'll take a look, thanks |
07:12:07 | absolutejam | I'm currently writing it in Python but also copy parts to Nim to get a feel for the language |
07:13:51 | FromGitter | <timotheecour> would be a good addition to a nim repl (which are currently based on readline/lineedit) or lldb/gdb frontend for nim |
07:17:30 | FromGitter | <timotheecour> @araq can i merge other ppl's PR (obivously after proper review and when I feel it’s not gonna be controversial) |
07:20:33 | FromGitter | <alehander42> Araq, often the CI's are red because of unrelated errors |
07:20:44 | FromGitter | <alehander42> at least this happened for several of my previous PR-s |
07:33:43 | * | pwntus quit (Remote host closed the connection) |
07:33:45 | * | BigEpsilon joined #nim |
07:38:49 | * | absolutejam quit (Ping timeout: 244 seconds) |
07:56:38 | Araq | yeah and that's my fault and I'm trying to minimize these problems by working on branches myself |
07:56:54 | Araq | which then quickly rot :P |
07:57:58 | Araq | it's not that I don't feel your pain, but I don't have many good solutions. The solution cannot be to merge PRs more quickly at the cost of code quality. |
08:00:35 | narimiran | dom96: are you here maybe? |
08:01:48 | FromGitter | <timotheecour> I suggested 1 concrete thing that I believe can improve things quite a bit: reviewer can give LGMT modulo fixing X,Y,Z, which avoids 1 back and forth; it’s assuming some level of trust and is applicable for small points |
08:02:03 | narimiran | LGMT? |
08:02:10 | FromGitter | <timotheecour> looks good to me. |
08:03:01 | FromGitter | <timotheecour> basically reviewer trusts the author will either fix and let him merge himself. (once CI green), or author can push back if he disagrees with suggested fix |
08:03:18 | narimiran | so, in more words: comment "fix X, Y and Z, and then it can be merged" + put 'merge when CI passes' label? |
08:03:20 | FromGitter | <timotheecour> (sorry typo, was LGTM) |
08:03:44 | FromGitter | <timotheecour> ya |
08:04:31 | Araq | and I suggested the CIs start to tell us when we break common Nimble packages |
08:04:45 | FromGitter | <timotheecour> yup, that will also happen. |
08:05:17 | * | Vladar joined #nim |
08:05:22 | narimiran | Araq: i started working on "common nimble packages" list. but haven't had the time to refine it yet |
08:05:38 | FromGitter | <timotheecour> cool do u have a link? |
08:06:19 | narimiran | it is just a list on my computer for now |
08:06:48 | Araq | timotheecour: Another possibility is to have 1 "Timothee" branch that you occasionally use for bigger PRs |
08:07:01 | narimiran | too early stage to be of any usage so i didn't make it public |
08:07:23 | Araq | will take some time to get merged then but it's preferrable over 150 branches and blocking you constantly |
08:09:36 | FromGitter | <timotheecour> well i could use that but violates the 1 PR 1 issue rule we have; it would help for some things though |
08:10:17 | Araq | the rules exist to be broken |
08:12:36 | * | absolutejam joined #nim |
08:12:56 | FromGitter | <timotheecour> ok; ⏎ what about extending set of ppl who can merge PR's? (with proper checks, eg reviewer takes full responsability yada yada) |
08:14:20 | narimiran | y'all know the story about traffic congestion and building more roads? |
08:14:35 | FromGitter | <timotheecour> fitting |
08:17:44 | Araq | timothee: ok, who |
08:19:11 | * | sheerluck joined #nim |
08:20:27 | * | absolutejam quit (Ping timeout: 240 seconds) |
08:20:41 | FromGitter | <timotheecour> some objective criterion based on past contributions; we can write a small paragraph on rules of the game in contributing.rst if needed to specify what requires more adult supervision (ie a LGTM from core dev) |
08:22:15 | Araq | no, who? |
08:28:16 | Araq | latest addition to the core team was a couple of weeks ago, shashlick (who is doing awesome work btw!) |
08:28:24 | FromGitter | <timotheecour> i’d say a subset of ppl with > 20 recent contributions (eg https://github.com/nim-lang/Nim/graphs/contributors?from=2017-08-10&to=2019-01-09&type=c) ; recent so that they’re familiar w recent changes; in addition to ppl who already can, maybe lemonboy, zah, yglukhov, nc-x, narimiran, mratsim, cooldome, i’m forgetting some |
08:28:53 | FromGitter | <timotheecour> shashlick of course |
08:29:02 | FromGitter | <timotheecour> but he’s already in core team |
08:29:05 | Araq | they all can merge PRs already, maybe mratsim can't, I don't have a complete list in my head |
08:29:23 | FromGitter | <timotheecour> (and myself hopefully) |
08:30:54 | Araq | I misread, sorry |
08:31:00 | FromGitter | <timotheecour> well i thought there was unofficial rule that if not in core dev, u can’t merge otehr ppl’s PR (regardless if u have github rights for that) |
08:32:13 | Araq | that's true :-) |
08:32:20 | narimiran | @timotheecour of those 20-30 people you mentioned: how many of them are willing to go through old PRs? of those, how many know the topic at hand and want to have a responsibility to merge something? |
08:32:54 | * | absolutejam joined #nim |
08:33:00 | FromGitter | <timotheecour> (and in practice too; the overwhelming majority is merged by just u @araq; then krux, then decreases exponentially) |
08:33:07 | FromGitter | <mratsim> I’m OK with going through old PR |
08:33:29 | narimiran | e.g. i see that relatively lot of those old PRs are passing the tests. should i merge them? why haven't they been merged already if it was that simple? (these are the questions i'd ask myself) |
08:33:38 | FromGitter | <mratsim> you can even create some kind of event on PR review like “saturday of review” once per month :p |
08:33:51 | FromGitter | <mratsim> you need to retrigger the tests I think |
08:34:02 | Araq | well we hired narimiran to do that, but he is already busy improving our docs |
08:34:33 | FromGitter | <timotheecour> i’m ok too; the necessary pre-condition for review is: shd be green, shd be fast-forwardable (caution old PR’s, need rebase); |
08:35:14 | Araq | well ... I'll think about it. One obvious rule should be "nobody merges his own PRs" ;-) |
08:35:47 | FromGitter | <timotheecour> (well unless it was explicitly approved) |
08:36:04 | FromGitter | <alehander42> yes, timothee, merge only my PR-s :p |
08:36:18 | Araq | yes ok, but approval needs to be done by somebody else |
08:36:56 | FromGitter | <timotheecour> well that’s kind of obvious |
08:37:02 | Araq | and it also cannot be that you ping e.g. @friendlyguy and hope for @araq to not look at it and get it merged |
08:37:28 | narimiran | if tests need to be re-run, and the reviewer is satisfied with the PR, put that 'merge when CI passes' label, and it will speed up the process. |
08:37:44 | narimiran | but for the process to start, there needs to be a (fresh) review |
08:37:52 | FromGitter | <alehander42> btw i can't put labels on my issues |
08:37:55 | FromGitter | <alehander42> is that a github limitation |
08:38:00 | FromGitter | <alehander42> or a permission one |
08:38:09 | narimiran | permission, AFAIK |
08:38:31 | FromGitter | <timotheecour> permision; u need to ask araq to enable u for that |
08:39:29 | FromGitter | <timotheecour> well @friendlyguy shdn’t be a reviewer if he’s not doing a proper review |
08:40:05 | * | absolutejam quit (Ping timeout: 250 seconds) |
08:40:19 | FromGitter | <alehander42> narimiran I see: isn't it possible to always enable the issue-creator to label his own issue? |
08:40:25 | Araq | ok, but just a couple of sentences ago you argued that contributor == good reviewer |
08:40:25 | FromGitter | <mratsim> we can also add a tag “ready for Iraq” :p |
08:40:35 | FromGitter | <mratsim> Araq* |
08:40:40 | * | narimiran not sure if typo or pun :D |
08:40:45 | FromGitter | <mratsim> autocorrect |
08:41:08 | FromGitter | <alehander42> otherwise i noticed e.g. andreaferretti and other ppl very quickly labels my stuff(and other issues) so its probably ok |
08:41:11 | FromGitter | <mratsim> I guess I’ll have the authorities watching me from now on |
08:41:21 | narimiran | :D |
08:41:43 | Araq | alternatively I can also delegate feature development more to you guys and review even more |
08:41:50 | FromGitter | <timotheecour> well @friendlyguy can have his right to merge revoked (for some time or for ever) if he abuses it |
08:42:20 | Araq | nobody "abuses" it, it's all "bad stuff with good intentions" |
08:42:26 | narimiran | btw, there are also lots of old issues that need to be looked at (and it is easier than PR reviewing), and lots of them are already fixed — i had a closing-spree while hacktoberfest, but i'm sure there's more |
08:42:36 | FromGitter | <alehander42> eh, people can have just bias |
08:43:29 | narimiran | what about: PR --> reviewers --> fix stuff --> ready for Araq's review |
08:43:58 | FromGitter | <alehander42> still not good enough I think: there are some things that e.g. Araq would never merge |
08:44:04 | FromGitter | <alehander42> so it's good to know this immediately |
08:44:11 | narimiran | that way Araq still reviews and approves things, but wastes less time on some basic things |
08:45:10 | narimiran | or even better idea: nobody opens up new PRs until we halve the number of currently open ones? :D :D |
08:45:22 | narimiran | (only 90% joking) |
08:45:22 | FromGitter | <timotheecour> No :) |
08:46:09 | FromGitter | <mratsim> that’s how Linux Torvalds scaled himself |
08:46:17 | FromGitter | <mratsim> he only does reviews |
08:46:29 | FromGitter | <mratsim> but It’s probably too early |
08:46:42 | FromGitter | <mratsim> no one will do destructors in your place Araq |
08:46:46 | FromGitter | <timotheecour> a critierion that i like is: a PR is good if nothing gets worse and at least 1 thing is improved |
08:47:33 | FromGitter | <mratsim> For me, I’m OK with PR that fixes bug that only get a second look |
08:47:37 | Araq | mratsim: cooldome does it already |
08:47:44 | FromGitter | <mratsim> PR that adds feature need to be vetted by Araq |
08:47:52 | FromGitter | <mratsim> to avoid feature creep |
08:47:56 | Araq | but he is not working on --gc:destructors afaict |
08:49:10 | FromGitter | <timotheecour> btw it’s open source, so it’s really easy to audit if a reviewer does a bad job by approving stuff that’s obviously subpar |
08:50:03 | Araq | it's incredibly demotivating to remove rights to somebody |
08:50:13 | Araq | *from |
08:50:23 | FromGitter | <timotheecour> it can be a private ping |
08:50:49 | Araq | I don't think that changes anything |
08:51:25 | FromGitter | <mratsim> well, I think we should start doing something and assuminge people are reasonable, instead of imagining all the ways it can go wrong. You wouldn’t have started your own language from scratch otherwise ;) |
08:51:41 | FromGitter | <mratsim> and assume that* |
08:52:22 | narimiran | sooo, tomorrow morning there be less than 80 open PRs? ;) |
08:52:30 | * | zyklon quit (Read error: Connection reset by peer) |
08:52:35 | FromGitter | <timotheecour> totally agree. too many contributors/reviewers has never been Nim’s problem ; we can see how it goes and corrective action if it doesn’t. |
08:53:05 | Araq | ok. Glad we figured that out. |
08:53:24 | Araq | anything that I need to do now... :P |
08:53:27 | Araq | ? |
08:53:45 | FromGitter | <mratsim> forum post? |
08:54:13 | FromGitter | <mratsim> “Plan to tackle PRs in the future" |
08:54:31 | FromGitter | <mratsim> or even blog post, so we can HN/reddit that ;) |
08:54:38 | FromGitter | <mratsim> cc @narimiran |
08:54:44 | FromGitter | <timotheecour> we can add a blurb in https://nim-lang.github.io/Nim/contributing.html specifying reviewer responsability |
08:54:51 | narimiran | isn't this just an internal thing? |
08:54:55 | FromGitter | <mratsim> oh excellent idea |
08:55:02 | narimiran | no need for public post about it, IMO |
08:55:05 | Araq | seriously guys? |
08:55:20 | FromGitter | <mratsim> contributing at minimum |
08:55:46 | narimiran | @timotheecour write something there. (and then wait for a PR review for that :D :D) |
08:55:56 | FromGitter | <timotheecour> Lol. sure. |
08:56:00 | Araq | just review PRs |
08:56:17 | Araq | often somebody mentioned what remains to be done |
08:58:04 | FromGitter | <alehander42> ok, in this case i'd like to be able to review javascript backend/javascript lib stuff: I feel like i am one of its main users and breakage/changes affect my code daily (and i have to finish my rewrite of it one day) |
08:58:34 | narimiran | @alehander42 what is stopping you from being able to review that? |
09:00:17 | FromGitter | <timotheecour> that’s acutally raising a good point; obviously anyone can review a PR including your neighbors’s dog as doesn’t require permissions; but oftentimes what actually happens is unless someone has permission to merge, he has less incentive to review |
09:01:25 | * | floppydh joined #nim |
09:02:23 | FromGitter | <timotheecour> drive by comments is good and welcome, but is different from a review where a reviewer puts his stamp on. no merge rights often implies less thorough review. in practice. |
09:03:39 | narimiran | let's try it and see how it goes |
09:03:58 | narimiran | don't let the perfect be the enemy of the good |
09:06:15 | FromGitter | <alehander42> @narimiran good point: you're right that i don't need permissions for that. hm, then i am just declaring that i'll try to ⏎ take a look at all javascript-related issues/pr (so e.g. people can know they can ping me about them etc) |
09:07:19 | narimiran | @alehander42 great to hear! |
09:08:18 | narimiran | if you think that adding some labels to those PRs would be beneficial (and i guess it would), we should give you the permission to make it possible |
09:08:49 | * | tradfursten joined #nim |
09:08:58 | FromGitter | <mratsim> @narimiran: I think we should backport that: https://github.com/nim-lang/Nim/issues/10075 |
09:09:23 | FromGitter | <alehander42> narimiran: yeah, I guess labels would be useful |
09:10:00 | narimiran | @mratsim so this should be backported? https://github.com/nim-lang/Nim/pull/8715/ |
09:10:02 | * | zyklon joined #nim |
09:10:50 | narimiran | @alehander42 it is not up to me, but feel free to remind me later if nothing happens (you don't have permission) |
09:10:51 | FromGitter | <mratsim> it fixes a bug that was always there and a regression. |
09:11:08 | FromGitter | <mratsim> I think the fact that it fixes a regression is a side-effect |
09:11:09 | FromGitter | <mratsim> :P |
09:11:30 | narimiran | @mratsim i'll leave that backport decision to Araq |
09:11:57 | FromGitter | <alehander42> narimiran: ok, thanks |
09:33:35 | * | tradfursten quit (Ping timeout: 256 seconds) |
09:35:08 | Araq | what needs to be done with the old PRs is "stay tuned, I'm taking over" |
09:35:09 | * | PMunch joined #nim |
09:35:52 | Araq | and again, testing Nimble packages in the wild out there is prio number one, we have extensive tests, apparently they are never good enough, so let's try something new |
09:36:57 | Araq | we can also think about removing tests that are too simple in exchange for more realworld testing if the CIs start to timeout again |
09:37:23 | narimiran | Araq: ok, i'll try to have the initial version of nimble package list for tomorrow |
09:37:56 | narimiran | and i agree about removing assert `2+2 == 4` kinds of tests |
09:39:24 | Araq | the CIs are now controlled by koch.nim btw, we can have a testpackages.nim file and ask our community to add their projects |
09:39:59 | Araq | you don't have to do it yourself, narimiran, you only need to start |
09:40:57 | Araq | and packages are platform specific so they can get 'when defined(linux): testPackage("giturl_here", "nim c -r tests/tester.nim")' |
09:41:17 | narimiran | i'm against everybody adding their project. i think this list should contain only big/popular projects. |
09:41:49 | narimiran | but let's have *something* for a start, and see where will that take us |
09:41:54 | Araq | ok |
09:42:11 | FromGitter | <alehander42> does nimble have some kind of downloads stat |
09:43:06 | narimiran | @alehander42 that would be useful, indeed. for my list, i used github stars as a criterion for picking the packages |
09:44:38 | Araq | only *my* Nimble packages are important :P |
09:47:00 | Araq | mratsim: happy with your rights? |
09:47:10 | narimiran | Araq: did you see the above discussion with @mratsim about should we backport https://github.com/nim-lang/Nim/pull/8715 ? |
09:47:13 | Araq | alehander42: happy with your rights? |
09:47:32 | Araq | narimiran: just looked at it, can't backport that one I'm afraid |
09:47:40 | narimiran | ok |
09:50:43 | narimiran | btw, @mratsim, that PR (#8715) didn't solve the issue (#10075) from what i can tell? |
09:51:09 | narimiran | oh, i misunderstood the comment "The code is added to fix #8715" |
09:51:26 | FromGitter | <alehander42> Araq: yeah, just wanted the right to label issues |
09:54:50 | Araq | narimiran: but please backport my docgen fix that speeds up runnableExamples |
09:54:53 | FromGitter | <mratsim> @Araq, did you add new rights? I’m happy with mine yeah |
09:57:30 | narimiran | Araq: ok, it is this one https://github.com/nim-lang/Nim/commit/086229459aa72f06d31a4f920653a82a74cfc6b0 . if there's anything else to backport (which doesn't have the backport tag), let me know |
09:58:03 | Araq | there is another commit fixing that one... |
09:58:22 | Araq | maybe move docgen.nim over to 0.19 |
10:02:59 | narimiran | ok, found that fix |
10:05:53 | * | rayman22201 quit (Ping timeout: 256 seconds) |
10:07:36 | narimiran | backported some recent documentation fixes too |
10:10:24 | * | dom96_w joined #nim |
10:14:45 | * | abm joined #nim |
10:17:42 | Araq | yay |
10:56:39 | * | stefanos82 joined #nim |
11:10:39 | Araq | ping dom96_w |
11:10:46 | dom96_w | yes? |
11:12:15 | * | theelous3 joined #nim |
11:33:09 | * | dom96_w quit (Quit: Textual IRC Client: www.textualapp.com) |
11:34:22 | * | hoijui joined #nim |
11:34:37 | FromGitter | <alehander42> Araq, what is `astdef` |
11:35:41 | Araq | the meaning of sym.ast changed |
11:35:49 | Araq | sym.astdef gives you the old meaning |
11:36:04 | Araq | only skLet, skVar and maybe skConst are affected |
11:36:25 | Araq | for the JS codegen you should use 'astdef' |
11:36:42 | FromGitter | <alehander42> yeah, good to know! |
11:36:53 | FromGitter | <alehander42> otherwise there is a bug in https://github.com/nim-lang/Nim/blob/devel/compiler/semstmts.nim#L335 |
11:37:05 | FromGitter | <alehander42> there should be a check for v.astdef.typ.isNil |
11:37:23 | Araq | possible |
11:37:26 | FromGitter | <alehander42> because otherwise some pragmas with notnil types are segfaulting |
11:37:30 | FromGitter | <alehander42> (my codebase) |
11:37:38 | FromGitter | <alehander42> ok, PR-ing |
11:38:11 | FromGitter | <alehander42> (i just wondered if v.astdef.typ is always supposed to be valid) |
11:48:22 | Araq | (I think so.) |
11:49:41 | FromGitter | <alehander42> well it's nil on several places in my codebase, so maybe there is a deeper bug there |
11:49:49 | narimiran | version 0.19 branch failed with "The command "if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install boehmgc; fi" failed and exited with 1 during ." :/ |
11:50:03 | FromGitter | <alehander42> but the check fix cant hurt |
11:51:31 | FromGitter | <alehander42> even for a simple notnil type astdef.typ is nil |
12:02:52 | * | bgiannan joined #nim |
12:03:45 | * | hoijui quit (Ping timeout: 268 seconds) |
12:05:12 | narimiran | somebody was quicker than me: there's a new article about Nim in 2018 here: https://nim-lang.org/blog/2019/01/08/nim-in-2018-a-short-recap.html |
12:05:22 | narimiran | HN discussion here: https://news.ycombinator.com/item?id=18863759 |
12:06:44 | narimiran | reddit discussion here: https://old.reddit.com/r/programming/comments/ae67ns/nim_in_2018_a_short_recap/ |
12:07:45 | narimiran | feel free to share your experience with Nim in 2018 and/or answer some questions that might arise |
12:13:42 | bgiannan | trying to compile a first program with nim |
12:13:59 | bgiannan | I get "invalid module name: test-nim" |
12:14:05 | bgiannan | what am I missing ? |
12:14:47 | zyklon | quite the opposite :D |
12:15:00 | FromGitter | <alehander42> narimiran, i replied with some of the ecosystem stuff, but i am forgetting a lot probably |
12:15:21 | narimiran | bgiannan: remove `-` |
12:15:56 | * | hoijui joined #nim |
12:16:05 | bgiannan | can i compile to c and see the generated code ? |
12:16:22 | zyklon | it's in the nimcache dir |
12:16:27 | bgiannan | 90K seems quite big for just "hello world" |
12:17:37 | Zevv | -d:release |
12:18:14 | * | hoijui quit (Remote host closed the connection) |
12:18:28 | bgiannan | where's the nimcache dir ? |
12:21:36 | * | Cthalupa quit (Ping timeout: 246 seconds) |
12:22:04 | bgiannan | rtfm i can set it with --nimcache |
12:22:18 | zyklon | in the same dir as your .nim file by default |
12:22:41 | narimiran | zyklon: not true anymore |
12:23:03 | zyklon | oh sry |
12:23:20 | narimiran | bgiannan: by default, nimcache is now in ~/.cache/nim |
12:23:26 | bgiannan | thx |
12:23:28 | zyklon | I use an old version probably |
12:23:50 | * | Cthalupa joined #nim |
12:23:52 | narimiran | bgiannan: as Zevv said, to reduce the size (and get the much faster release version), use `-d:release` |
12:24:25 | narimiran | bgiannan: you can also use `--opt:size` for some additional size shrinking |
12:24:38 | bgiannan | beat |
12:24:40 | bgiannan | neat* |
12:26:53 | * | xet7 quit (Quit: Leaving) |
12:31:30 | * | BigEpsilon quit (Ping timeout: 268 seconds) |
12:33:01 | * | BigEpsilon joined #nim |
12:33:10 | * | theelous3 quit (Ping timeout: 250 seconds) |
12:36:30 | * | dom96_w joined #nim |
12:36:42 | dom96_w | yay, front page of HN |
12:36:49 | dom96_w | Good job narimiran :) |
12:36:56 | narimiran | weee |
12:39:15 | PMunch | Nice, #2 spot even |
12:40:09 | narimiran | PMunch: it was #1 few minutes ago ;) |
12:40:24 | dom96_w | Araq: if you want to fix that redirect issue: try opening /etc/nginx/sites-available/nim-lang.org (paste it for me and pm me the link and I should be able to tell you what to modify) |
12:42:16 | * | nsf quit (Quit: WeeChat 2.3) |
12:44:47 | narimiran | "number of open issues" is the new "i don't like style insensitivity" :D |
12:46:51 | dom96_w | just wait... lol |
12:47:32 | FromGitter | <alehander42> nah number of open issues is very easily refutable |
12:48:03 | narimiran | haha, i know i know, i should have said "inb4 stYle_inSenSi_tiviTy" :D |
12:49:39 | zyklon | it turned into the usual autistic "hacker""news" shitshow |
12:50:53 | narimiran | i'm surprised by no comments on reddit |
12:51:23 | dom96_w | reddit is slow |
12:51:36 | dom96_w | doesn't get as much traffic as HN unless you get 2k+ upvotes |
12:53:16 | PMunch | Should've mentioned nimlsp so I could get some more guinea pigs for testing it :P |
12:53:29 | PMunch | So far I'm the only one I know who uses it, and it's really nice |
12:53:38 | dom96_w | announce it on the forum ;) |
12:56:56 | narimiran | PMunch: we need to leave something for 2019 ;) |
13:05:59 | Araq | PMunch: I want to use it, does if fix the project management problems the old plugin has? |
13:06:06 | Araq | *does it |
13:06:20 | PMunch | What do you mean? |
13:06:53 | Araq | the old plugin runs 'nim check' on the current file, ignoring the project info |
13:07:01 | Araq | and spawns dozens of nimsuggest instances |
13:07:32 | PMunch | Well, this doesn't spawn any nimsuggest instances as it uses it as a library. But it does keep a state object for each detected "project file" |
13:08:16 | PMunch | The way it detects the project file is this: https://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim#L98 |
13:08:17 | Araq | that's ok if you don't assume Nim file == project file |
13:08:37 | Araq | there is a proc for that in the compiler |
13:08:43 | Araq | no need to reimplement this logic |
13:09:43 | PMunch | Why doesn't nimsuggest use that then? |
13:09:51 | Araq | IT DOES! |
13:09:58 | * | zyklon quit (Read error: Connection reset by peer) |
13:10:02 | PMunch | Why does it ask for a project file then? |
13:10:49 | Araq | pass it a directory and it detects the project file |
13:12:14 | PMunch | What directory? |
13:12:19 | PMunch | The one the file is in? |
13:12:29 | PMunch | Then it should just be able to figure it out based on the file |
13:13:07 | PMunch | So this should just be removed? https://github.com/nim-lang/Nim/blob/devel/nimsuggest/nimsuggest.nim#L662 |
13:14:49 | * | xet7 joined #nim |
13:18:22 | * | bgiannan left #nim ("WeeChat 2.3") |
13:20:36 | * | absolutejam joined #nim |
13:25:21 | leorize | is there any path from nim-lang.org to Araq's blog? afaict you can only access the blog once someone posted the link to an article somewhere |
13:27:52 | * | zyklon joined #nim |
13:36:35 | * | vlad1777d_ joined #nim |
13:37:00 | * | Vladar quit (Remote host closed the connection) |
13:37:43 | absolutejam | can anyone explain the {.inline.} pragma to me please? |
13:38:33 | Zevv | It requests the C compiler to put the code of the function in the callee, instead of making it a function and doing a call |
13:38:53 | Zevv | basically it increases binary size, and might benefit performance. |
13:39:09 | Zevv | Usually you shouldn't care for this and just leave it to the compiler, as it knows best what to inline and what not |
13:39:16 | PMunch | https://www.greenend.org.uk/rjk/tech/inline.html |
13:39:38 | PMunch | Basically it does that to your C code |
13:40:34 | FromGitter | <mratsim> compiler will never inline across module boundaries if you don’t put the inline pragma |
13:40:34 | * | zyklon quit (Read error: Connection reset by peer) |
13:40:47 | absolutejam | as somebody who knows nothing of C |
13:40:54 | absolutejam | Should I leave it until I understand it? |
13:41:05 | PMunch | Yeah |
13:41:11 | absolutejam | I'm reading that link still |
13:41:20 | PMunch | Probably won't do anything good unless you know how to use it |
13:41:30 | PMunch | How did you even end up looking at it? :P |
13:41:31 | Zevv | After 25 years I'd like to think I start to understand bits of C, and I usually leave it |
13:41:38 | absolutejam | I'm not disregarding what you said; I'll read it and ignore using it for now |
13:41:42 | absolutejam | It's in the docs |
13:41:47 | Zevv | PMunch: its in the manual |
13:41:58 | absolutejam | Reading about the getter/setter syntax for properties |
13:42:38 | absolutejam | mind if I drop another stupid question? |
13:42:49 | absolutejam | what's the difference between a proc and a method? |
13:43:09 | Zevv | dynamic/static dispatch, that's an OO thing |
13:43:20 | narimiran | (the answer to that question should really be documented, as it is relatively frequently asked one) |
13:44:20 | PMunch | Well it is documented here: https://nim-lang.org/docs/tut2.html#object-oriented-programming-dynamic-dispatch |
13:44:35 | absolutejam | it may be because some of the language features are new to me too |
13:45:03 | FromGitter | <zetashift> I have no idea what dynamic dispatch really means I always looked at it like methods are members/bount to an object while procs are standalone functions |
13:46:05 | absolutejam | I thought DD was ability to to declare the same function multiple times, based on different types of the arguments |
13:46:24 | absolutejam | I need to read more on the basics of OOP, haha |
13:46:32 | FromGitter | <alehander42> this is overloading |
13:46:43 | FromGitter | <alehander42> it's a more general concept |
13:47:20 | FromGitter | <alehander42> the idea behind dynamic dispatch is that the actual method being called might be decided on runtime |
13:47:46 | * | theelous3 joined #nim |
13:47:56 | FromGitter | <alehander42> based on a runtime "type" e.g. the object subclass type in OOP |
13:48:41 | absolutejam | right |
13:48:56 | absolutejam | We're not in ~Kansas~Python now Dorothy |
13:49:29 | narimiran | (as we've just seen, this needs to be *better* documented ;)) |
13:49:44 | Zevv | absolutejam: and a small "beware": for reasons that I do not grok, there is something fishy in Nim with mixing methods and generics. |
13:50:02 | Zevv | The docs don't speak about this caveat, but Araq told me not use either one, but not both. |
13:50:03 | FromGitter | <alehander42> on the other hand, overloading means you can e.g. define `a(b: int)` and `a(b: seq[int])` and they would be different, but usually it's clear on compile time which one would be called(static dispatch) |
13:50:20 | FromGitter | <zetashift> with the help of a virtual table? |
13:50:29 | FromGitter | <alehander42> (of course method overloading leads to dd) |
13:51:02 | FromGitter | <zetashift> I've rarely seen methods being used, only in godot-nim mainly but that's because it's handy with declaring those types |
13:51:07 | Araq | Zevv: that's because you discovered the problems with them :P |
13:53:04 | absolutejam | Well, I was using a method because that's the terminology I'm used to when declaring classes |
13:53:11 | absolutejam | So I can just stick to procs? |
13:53:45 | * | vlad1777d__ joined #nim |
13:53:46 | absolutejam | I'm a hobbyist (sysadmin by trade) and I've been using Python thus far |
13:54:38 | absolutejam | now I'm trying my hand at Nim, but I'm well aware there are a lot of concepts that I only know about, especially when moving to a compiled language |
13:54:41 | FromGitter | <zetashift> Nim is mostly procedural so yes try not to think in terms of classes |
13:55:03 | FromGitter | <alehander42> probably you can for the beginning |
13:55:29 | FromGitter | <zetashift> Weren't there OOP macros which made it easier? |
13:55:44 | absolutejam | there's still a usable OOP side though, right? |
13:55:51 | absolutejam | I mean, the docs seem to imply there is |
13:55:52 | FromGitter | <alehander42> those are not really idiomatic nim, so it's better to not use them if you're a beginner |
13:56:06 | absolutejam | how old is Nim by the way? |
13:56:35 | * | zyklon joined #nim |
13:56:43 | * | vlad1777d_ quit (Ping timeout: 245 seconds) |
13:56:45 | FromGitter | <zetashift> 11 years? |
13:56:50 | PMunch | A quick example of the usage of DD I just threw together: http://ix.io/1xSD/Nim |
13:56:54 | absolutejam | oh wow, didn't realise |
13:57:09 | FromGitter | <alehander42> yes, oop is available, but it's just not used so much: often people use just procs or variant types + proc |
13:57:18 | FromGitter | <alehander42> (of course sometimes this is not enough) |
13:57:44 | PMunch | If those were procs it would just print 3 "Unspecified thing", with methods it will use the correct one for Unit, or Value |
13:58:36 | PMunch | 99% of the time you can simply use something other than OOP |
13:59:40 | FromGitter | <zetashift> I think it's because OOP is taught everywhere and in the beginning it's really easy to reason about it too |
14:02:27 | Araq | my wish for the new year: people stop using "easy to reason about" when they mean "I like it better" |
14:03:31 | shashlick | nice discussion last night |
14:03:49 | shashlick | can this be merged? https://github.com/nim-lang/Nim/pull/9806 |
14:03:57 | shashlick | seems simple enough |
14:04:06 | FromGitter | <zetashift> mhmh maybe there is some misunderstanding here, I didn't mean I like OOP better, I like procedural/FP a lot more now, but the initial learning curve for both paradigms are different |
14:05:17 | Araq | oh you're also free to like OOP better, but it most certainly isn't easy to reason about and even it were, you would need to argue why that is |
14:05:20 | absolutejam | I was aiming for basic OOP because I want to emulate a repl with access to classes that are nice and easy to mutate |
14:05:45 | Araq | shashlick: ok |
14:06:10 | absolutejam | I've been toying with Clojure but I honestly don't have the programming background or insight to reason when to decide on OOP/FP |
14:07:06 | shashlick | Araq: ran into this while enabling stdin reading in VM - https://github.com/nim-lang/Nim/issues/10240 |
14:07:17 | Araq | I noticed |
14:07:28 | Araq | fix it |
14:07:41 | shashlick | 😄 |
14:08:09 | shashlick | so seems like nimble package testing is higher priority - where do we want to run those |
14:08:47 | shashlick | do we want that to run in separate repo, nim-lang/nim or nightlies |
14:12:33 | dom96_w | wow https://news.ycombinator.com/item?id=18864730 |
14:13:06 | * | dddddd_ joined #nim |
14:15:54 | narimiran | dom96_w: wow indeed |
14:16:01 | narimiran | "did someone here had a better or different experience than mine?" |
14:16:22 | narimiran | people, it's your turn ;) |
14:16:48 | FromGitter | <alehander42> i feel he just wants a different language |
14:17:08 | FromGitter | <alehander42> something like scala |
14:17:29 | narimiran | i think we should write some replies. not for him to change his mind, but for some general information for the public |
14:17:54 | Araq | shashlick: preferably nim-lang/nim if it weren't for the timeout problems |
14:18:36 | narimiran | Araq: ...but there are timeout problems, so delegate that to nightlies? |
14:19:01 | Araq | are there? they have become rarer thanks to megatest |
14:19:53 | narimiran | ok, i'll rephrase: we need to make tests (even) faster |
14:20:08 | shashlick | can we also have a megadoc - nightlies docs takes a long time as well |
14:20:40 | FromGitter | <timotheecour> @dom96 what’s easiest way to run `nimble test` ? i can run it inside `nimble develop foo` but doesn’t work if run inside the install dir (after `nimble install foo`) ; so do is my best bet to run both `nimble install foo` (to test co-installation) and `nimble develop + nimble test` ? |
14:21:12 | FromGitter | <timotheecour> (for the PR on nimble CI, see https://github.com/nim-lang/Nim/pull/10247) |
14:22:48 | shashlick | @timotheecour - tests do not get installed |
14:22:58 | shashlick | so you need to clone the repo, not simply nimble install |
14:23:51 | shashlick | maybe we can add a --tests flag to nimble so that tests also get installed - that way we can test packages with nimble install package and then cd packagepath and nimble test |
14:24:48 | shashlick | @timotheecour - we also need to port your ci streamlining into nightlies |
14:25:07 | dom96_w | narimiran: I replied |
14:25:30 | * | dddddd_ is now known as dddddd |
14:26:04 | FromGitter | <zetashift> @Araq I think when I started learning about classes was using Python and seeing how I could structure things in a game as objects in pyGame was easy to grasp then. Maybe it's because in gamedev a lot of things are done using OOP languages and not actually because OOP is easier to reason about |
14:26:11 | * | xet7 quit (Quit: Leaving) |
14:27:23 | FromGitter | <alehander42> @dom96 he is talking about deep immutability |
14:27:53 | dom96_w | Then he should be more specific ;) |
14:27:56 | * | nsf joined #nim |
14:28:01 | * | BigEpsilon quit (Ping timeout: 244 seconds) |
14:30:01 | FromGitter | <alehander42> he just wants a different kind of language, but the problem is anecdotical evidence like "i wrote this programs once which was slow" |
14:30:17 | FromGitter | <alehander42> this is hard to refute in discussions like this |
14:31:30 | Araq | btw what we should do more is to collect bugs. Real bugs caused by nim's design. |
14:32:28 | Araq | "I think I might mutate someday something I'm not supposed to" is a not a real language defect, it's s a perceived one. |
14:32:42 | * | dddddd quit (Read error: Connection reset by peer) |
14:33:10 | Araq | and I actually agree with that, but that doesn't make it a real defect either. |
14:33:13 | narimiran | @mratsim can you edit your HN post to fix that extra-long code line (which isn't code)? i'm guessing that's because some initial spaces |
14:34:00 | FromGitter | <mratsim> @narimiran several fixes |
14:34:25 | narimiran | @mratsim great |
14:36:56 | * | dddddd joined #nim |
14:39:42 | * | theelous3 quit (Ping timeout: 250 seconds) |
14:42:59 | shashlick | Araq: the nimscript not raising exceptions hasn't worked as far back as 0.16.0 |
14:43:13 | shashlick | tht's as far as i've checked |
14:43:45 | * | Tyresc joined #nim |
14:47:35 | absolutejam | is there any in-built documentation within nim? |
14:47:36 | FromGitter | <kaushalmodi> shashlick: I don't think many people using nims until recently |
14:48:22 | absolutejam | It looks like there's no in-built repl, but any way to reference in-built procs etc? I don't _think_ the vscode plugin has this either? |
14:49:12 | FromGitter | <kaushalmodi> absolutejam: check out the Inim package in nimble; it mimicks a REPL |
14:49:18 | absolutejam | I just pulled that |
14:49:49 | absolutejam | but I'm wondering if there's any kind of doc()/help()/dir() etc. functions |
14:49:50 | FromGitter | <kaushalmodi> You should just need to do `nimble install inim` |
14:49:56 | Araq | shashlick: possible |
14:50:07 | dom96_w | absolutejam: Here is what we usually use to find things: https://nim-lang.org/docs/theindex.html |
14:50:20 | shashlick | dom96_w: are release packages not posted for nim releases before 0.15.2? |
14:50:44 | * | jugash[m] joined #nim |
14:50:45 | absolutejam | Yeah, I meant with inim |
14:50:47 | absolutejam | my bad |
14:50:49 | absolutejam | with nimble* |
14:50:54 | FromGitter | <alehander42> Araq: on the other hand having deep immutability for X helps you to directly prove that a class of stuff can't happen : not always necessary, but obviously useful in principle |
14:51:02 | * | BigEpsilon joined #nim |
14:51:05 | FromGitter | <kaushalmodi> absolutejam: yeah, those things are not there. I use devdocs or the theindex page that dom96 pasted |
14:51:25 | absolutejam | cool, thanks |
14:55:38 | narimiran | HN discussion posted 4 hours ago, 35 comments, and not *one* mention of case insensitivity |
14:55:49 | narimiran | if this isn't a success, i don't know what it is :) |
14:56:21 | Araq | alehander42: in principle everything always helps, in practice type system complexity becomes a real problem |
14:56:25 | * | Snircle joined #nim |
14:56:50 | dom96_w | narimiran: don't jinx it! |
14:58:03 | narimiran | haha, you know it will happen sooner or later |
14:58:22 | dom96_w | Maybe I should just comment about it, just to ruin their element of surprise :P |
14:58:30 | Araq | types encode invariants and are bad at modeling things that are not always true from the beginning. Like mutability which fades away after construction but the construction can be arbitrarily complex |
14:59:09 | shashlick | dom96_w - am trying to install older versions of nim but choosenim cannot find anything before 0.15.2 |
14:59:12 | FromGitter | <alehander42> Araq, yeah, I just said that immutability is a reasonable type system feature: not saying we need it in Nim |
14:59:22 | shashlick | this is on windows |
14:59:31 | Araq | we have it, only 'ref' and 'ptr' breaks it |
14:59:32 | dom96_w | shashlick: likely because the .tar.gz doesn't exist for those |
14:59:51 | shashlick | I see - what about windows binary releases |
14:59:56 | shashlick | when did those start getting posted? |
15:00:14 | shashlick | so i guess my change to install from github is useful to test these older versions |
15:00:15 | FromGitter | <alehander42> Araq: that's true, but I think one can model the "fading" in a hypothetical language |
15:00:34 | Araq | solution: don't use ref/ptr. Alternative: push for write tracking. Other alternative: Complain about it. |
15:00:38 | FromGitter | <alehander42> e.g. having different contexts for init/after init and a mut type/imm type in them |
15:00:54 | absolutejam | holy crap, .a_b is the same as .aB |
15:01:07 | Araq | absolutejam: sshhhhttt :-) |
15:01:08 | FromGitter | <alehander42> @dom96 what did you do .. |
15:01:10 | absolutejam | did I just balls that up, or is that legit? |
15:01:57 | shashlick | absolutejam: https://nim-lang.github.io/Nim/manual.html#lexical-analysis-identifier-equality |
15:02:04 | FromGitter | <alehander42> Araq: the problem with this is that "use an index in a collection" isn't a good replacement for ref/ptr |
15:02:30 | narimiran | absolutejam: congrats, you win today's prize :) |
15:02:30 | FromGitter | <alehander42> because often you just get silent data corruption |
15:02:31 | dom96_w | alehander42: hrm? |
15:02:38 | Araq | I disagree, it's a nice solution with lots of other benefits |
15:02:43 | FromGitter | <alehander42> absolutejam found out about aB a_b :D |
15:03:35 | shashlick | dom96_w - once you merge the windows release zip PR for choosenim, i'll submit one for downloading nim from github if not on http://nim-lang.org |
15:03:45 | dom96_w | alehander42: I wasn't the one bringing up style insensitivity :P |
15:04:02 | * | narimiran hides |
15:04:15 | dom96_w | huh, I thought unicode was always case sensitivie in Nim though |
15:04:17 | dom96_w | did that change? |
15:04:30 | Araq | no, it still is |
15:04:35 | FromGitter | <alehander42> Araq: so what's your opinion about the data corruption thing? sometimes you need to make sure all your "index" operations lead to valid state and that you don't override "fresh" values etc etc .. reinventing stuff |
15:04:44 | shashlick | dom96_w - I'll also submit another PR to download a corresponding tagged csources version and only donwload latest if an equal csources tagged version doesn't exist |
15:04:52 | FromGitter | <alehander42> it's a ok approach but it doesn't come for free |
15:05:01 | Araq | there is no "data corruption thihng" |
15:05:09 | absolutejam | wow, magic |
15:05:18 | Araq | my opinion is to deny it exists |
15:05:41 | Araq | you have indexing checking and don't reuse indexes |
15:06:04 | FromGitter | <alehander42> well, how can you mutate something then |
15:06:08 | dom96_w | how can a_b be the same as aB then? |
15:06:09 | dom96_w | bbl |
15:06:09 | Araq | like the databases do it, since 1960 or something |
15:06:13 | * | dom96_w quit (Quit: Textual IRC Client: www.textualapp.com) |
15:06:55 | Araq | alehander42: That's the point, in order to mutate it you also need to have the owner/collection |
15:07:25 | Araq | it's similar to a capability based system |
15:08:37 | shashlick | Araq: how do i start debugging the nimscript exception issue? not familiar with the VM |
15:09:47 | FromGitter | <alehander42> Araq: ok, and you want to change the element 2: so everything else that has `this owner, index 2` can read the new value |
15:10:01 | FromGitter | <alehander42> you reuse the index 2 in this case |
15:11:36 | Araq | vmops.nim getCurrentExceptionMsgWrapper, shashlick |
15:12:29 | absolutejam | is nimscript interpreted nim on a VM? |
15:12:51 | absolutejam | or I guess JIT, not interpreted (?) |
15:13:22 | Araq | alehander42: but what else has "this owner, index 2"? there is no aliasing possible. |
15:13:24 | absolutejam | nevermind, found the docs |
15:13:24 | shashlick | awesome thanks! |
15:16:33 | FromDiscord_ | <moerm> Hello - and congrats to the Nim team! Just saw it via HN and I liked in particular the last part (-> 0.20 ~ 1.0rc) very much 😉 - So, a big THANK YOU to Araq and the Nim team! |
15:18:23 | FromGitter | <alehander42> @Araq : so a value can have only one owner at a given point? |
15:18:53 | Araq | that's the "natural" model of value semantics where you nest objects in seqs etc |
15:18:56 | FromGitter | <alehander42> if this is true, one can just have rust-like borrow checking |
15:19:22 | Araq | you need to protect against f(a, a) for proc f(x: var T, y: T) |
15:19:23 | FromGitter | <alehander42> Araq: well my point was that sometimes you need aliasing and accessing the same value from multiple owners |
15:20:17 | Araq | this protection is also what Swift does afaik |
15:20:19 | FromGitter | <alehander42> otherwise some of the index/db stuff reminds me of https://floooh.github.io/2018/06/17/handles-vs-pointers.html |
15:21:28 | Araq | hmm seems to be the article I've been wanting to write |
15:21:50 | Araq | yes, handles are the better pointers. DBs use them and had memory safety from the beginning. |
15:21:55 | Araq | as do OSes. |
15:23:31 | FromGitter | <mratsim> cool article. I’m struggling with ref objects overhead in directed acyclic graphs ... |
15:23:58 | Zevv | Araq: thanks for picking op the epoll mem PR - hope cheatfate isn't mad :/ |
15:24:30 | FromGitter | <alehander42> Araq: the blog `handles` are not exactly the same as os `handles` , but otherwise yeah, i think it would be an interesting read for you |
15:30:09 | Araq | "would be"? I've read it |
15:30:36 | absolutejam | nim doesn't support ? or ! in proc names, right? |
15:30:54 | Araq | it's precisely what I have in mind |
15:31:16 | FromGitter | <alehander42> Ah ok |
15:32:16 | narimiran | absolutejam: right, and no _ at the end |
15:32:25 | absolutejam | I really enjoyed using '?' in clojure and Ruby |
15:32:41 | absolutejam | Just tried it out and I can get away with `xyz?` but that's pointless haha |
15:32:52 | Araq | Nim uses is/has prefixes instead |
15:33:05 | narimiran | absolutejam: is that for bool procs? use `isFoo` |
15:33:11 | absolutejam | yeah |
15:33:36 | absolutejam | think I saw mention of a style guide actually |
15:33:50 | Araq | alehander42: The question however, if how far this model scales in other domains |
15:33:50 | absolutejam | found it https://nim-lang.org/docs/nep1.html |
15:34:08 | narimiran | absolutejam: you started learning nim today? |
15:34:18 | Araq | I can see it work for the Nim compiler but it would take a year of refactoring |
15:34:25 | absolutejam | pretty much haha |
15:34:40 | absolutejam | I've looked at the site a couple of times prior |
15:34:48 | FromDiscord_ | <moerm> I think that is/has is a good approach. Readability (and understandability) always trumps ease of typing/short (C like) notation. |
15:35:08 | narimiran | absolutejam: well, you came just a half day too early — in couple of hours we'll have lots of learning resources at one place, so it should be easier for you to start |
15:35:28 | absolutejam | sweet, I'll stay tuned in |
15:35:40 | FromDiscord_ | <moerm> narimiran more good news ... great. Today seems to be a good day for uns Nimers |
15:35:42 | absolutejam | what's the best place for info - reddit/forums/mailing lists? |
15:36:00 | Araq | here, I'm afraid |
15:36:11 | narimiran | @moerm as i said on forum: i'm working on it ;) these are just the first results |
15:36:14 | FromGitter | <mratsim> the forum too |
15:36:30 | absolutejam | async info I mean |
15:36:39 | Araq | nothing beats talking to the bloke who knows everything |
15:36:40 | absolutejam | this IRC actually seems active, which is great |
15:37:25 | FromGitter | <mratsim> also dom book: https://github.com/dom96/nim-in-action-code/tree/master/Chapter3/ChatApp |
15:37:31 | FromDiscord_ | <moerm> @absolutejam The forum is a good place, too. Nim isn't yet perfectly well documented but it's actually very well feasible to understand and learn it |
15:37:35 | narimiran | absolutejam: yeah, on IRC you can get the answer the quickest, and sometimes you'll speak to the guy(s) behind it, and you don't even know :) |
15:38:13 | FromGitter | <mratsim> The book introduces an async multi-clients one server chat app in chapter 3 |
15:38:27 | FromGitter | <mratsim> though without buying the book you will only see the code |
15:38:29 | narimiran | for me, if it wasn't for IRC community, i would have probably quit nim |
15:38:42 | Araq | ouch. lol |
15:38:44 | FromDiscord_ | <moerm> @Araq Haha. Yes (the bloke who wrote it) ... but: a lot of people have a lot of things to ask. So my take is that that bloke shouldn'tz be abused as a first learners resource |
15:39:10 | FromGitter | <mratsim> and for async, it should be similar to Python AsyncIO and C# AFAIK |
15:39:25 | narimiran | absolutejam: there was a gist showing similarities between python and nim async, let me see if i can find it |
15:39:43 | absolutejam | I meant a async source of info |
15:39:48 | FromDiscord_ | <moerm> @absolutejam Oh, btw, dom96's book ("Nim in action" iirc) is a *really good* resource too! |
15:39:52 | absolutejam | like emails, forums, etc. |
15:39:52 | narimiran | (you mentioned python before, if i didn't confuse you with somebody else) |
15:39:58 | absolutejam | stuff I can look at later |
15:40:03 | absolutejam | IRC I will miss without a bouncer |
15:40:04 | narimiran | aaaaaahaaa |
15:40:10 | absolutejam | however, async is still on my list, so thanks :P |
15:40:34 | narimiran | damn, and i hoped i don't have to look for it :D |
15:40:52 | * | Ven`` joined #nim |
15:40:55 | FromGitter | <mratsim> everything said on IRC is logged: https://irclogs.nim-lang.org/ |
15:41:04 | narimiran | ok, it was faster than i thought to find it |
15:41:05 | narimiran | https://gist.github.com/juancarlospaco/7a486056786919387ec6f5e83d693908 |
15:41:07 | absolutejam | yeah, I'm almost all Python. I don't _really_ have a need for a language other than Python at the moment, I just wanted to see what else I could learn while on a hobby project |
15:41:10 | absolutejam | It may be the end of me |
15:41:53 | narimiran | absolutejam: that's what i thought too. and look at me now :) |
15:42:05 | FromDiscord_ | <moerm> I think it wouldn't be utterly wrong (from a certain perspective) to say that Nim is python on steroids. |
15:42:26 | absolutejam | I was originally looking at Crystal, but Nim seems to be way ahead |
15:42:34 | absolutejam | and I can't stomach Go |
15:42:37 | FromDiscord_ | <moerm> If you grok python you won't have a hard time groking Nim |
15:43:19 | absolutejam | After toying with Clojure, I find Macros fascinating |
15:43:24 | absolutejam | also wholey alien and confusing |
15:43:31 | narimiran | yeah, at first just sprinkle some `let` and `var`, rename `def` to `proc`, and you're 90% ready to go |
15:43:40 | l1x | absolutejam: :D |
15:43:48 | l1x | clojure is pretty good |
15:43:52 | Araq | dunno about that, Python is quite different. But some aspects translate well |
15:43:55 | narimiran | after a while, you'll see more and more differences between the two |
15:43:56 | l1x | you dont need macros for application development |
15:44:00 | FromDiscord_ | <moerm> crystal *seems* to be roughly the same league and kind but it isn't (e.g. readability, conceptual consistence), but one might say that Crystal is to Ruby what Nim is to Python |
15:44:12 | absolutejam | oh yeah, I just found them when reading about hte language |
15:44:21 | absolutejam | starting with the threading macros |
15:44:55 | FromDiscord_ | <moerm> Araq From the perspective if a Pythonista looking for something similar but more serious my statement isn't wrong I think |
15:44:59 | absolutejam | I really like Clojure l1x |
15:45:10 | l1x | yeah me too |
15:45:19 | l1x | i am just working on a http lib for it |
15:45:33 | FromGitter | <mratsim> Crystal main issue is windows :P, but Crystal was done with the goal of being able to map Ruby 1:1. While Nim “only” borrows the syntax/ergonomic feel |
15:45:35 | absolutejam | Well, I was drawn in to nim because of the surface similarities but already see it's way different to Python |
15:45:35 | l1x | i want to beat the other frameworks with performance :) |
15:46:05 | absolutejam | My biggest issue I experience with Clojure is just moving to a FP mindset |
15:46:14 | absolutejam | daren't go near haskell etc |
15:46:58 | FromDiscord_ | <moerm> *Of course* Nim is quite different from Nim when looking closer. But I guess that Nim is *the*serious (system etc) language that's easiest to grok for Pythonistas |
15:47:05 | l1x | absolutejam: you can write non-FP code easily |
15:47:54 | Araq | you can argue both ways, "Nim is only superficially similar to Python" or "Nim thought about how to map Python's features into a systems programming language setting" |
15:48:13 | absolutejam | the pep-8 and chill on https://gist.github.com/juancarlospaco/7a486056786919387ec6f5e83d693908 made me laugh |
15:48:33 | FromDiscord_ | <moerm> Araq Yep. |
15:49:11 | FromDiscord_ | <moerm> ... and more (than Pythons feature set). |
15:49:20 | Araq | the truth is somewhere in the middle I guess. plenty of Python's features have been adopted |
15:49:38 | absolutejam | just take the best of what you want I guess |
15:49:49 | absolutejam | you're not trying to be Python, just taking the best/most fitting bits |
15:50:26 | absolutejam | Like not requiring parens for proc calls or the uniform function thing |
15:50:31 | absolutejam | You can tell I paid a lot of attention |
15:50:35 | absolutejam | but both of those are slick |
15:50:41 | absolutejam | and they're very Ruby like |
15:50:51 | absolutejam | not just Ruby but that's what I have seen pieces in |
15:51:16 | * | chho1229 joined #nim |
15:51:16 | FromDiscord_ | <moerm> That's one of the funny (and good things) with Nim. Superficially it looks like - and *is* - an easy to learn language. But then what I call "the second journey" begins and one can discover a lot more and good stuff (but it's of course more complicated) |
15:51:33 | * | seni joined #nim |
15:51:46 | narimiran | yup |
15:52:22 | absolutejam | low floow/threshold, high ceiling |
15:52:28 | absolutejam | floor* |
15:53:16 | FromGitter | <mratsim> I didn’t start my async journey yet but I think I’m at my 4th journey in low-level Nim :P and 3rd journey in macros :D |
15:53:36 | FromDiscord_ | <moerm> mratsim *g |
15:54:57 | narimiran | @mratsim i'm still hoping that you'll write some blog post about your low-level journey |
15:55:13 | narimiran | that "X times faster min/max" seems like a nice candidate |
15:55:14 | absolutejam | what's more idiomatic - return or var|let result? |
15:55:27 | narimiran | absolutejam: result without let|var |
15:55:30 | FromGitter | <mratsim> I have an idea for a “Nim for High performance computing” blog post serie |
15:55:31 | * | chho1229 quit (Ping timeout: 256 seconds) |
15:55:38 | Araq | alehander42: Ada Spark also has interesting aliasing restrictions btw, you must not pass someGlobal to 'f' if 'f' uses it directly. |
15:55:42 | FromDiscord_ | <moerm> Btw. really, really funny: For years I used Python as my quick and dirty check something out, create some repetitive (e.g. C boilerplate, etc ... and since recently I began to find Python lacking and I started to those jobs in Nim - and it's actually faster!!! (well, at least for me) |
15:55:55 | narimiran | absolutejam: `result` is special, it is implicitly declared |
15:56:11 | absolutejam | ohh |
15:56:17 | absolutejam | I see |
15:56:26 | FromGitter | <mratsim> @absolutejam, usually result (without let/var) and return is used if you have multiple exit points from the function |
15:56:30 | FromDiscord_ | <moerm> Now, that's a statement, that's something to really love, wenn a language is easier and quicker for quick and dirty helper jobs ... and at the same time a fully fledged compiled systems language! |
15:56:49 | narimiran | absolutejam: see here https://narimiran.github.io/nim-basics/#_result_variable |
15:57:01 | Araq | alehander42: and it's very interesting because allowing this only results in bugs, most of the time |
15:58:34 | absolutejam | okay, so you've convinced me to write my new hobby project in nim |
15:58:41 | absolutejam | I was doing it in python then testing bits in Nim |
15:58:56 | absolutejam | you only have yourselves to blame. |
15:59:09 | narimiran | absolutejam: see you around then :) |
15:59:36 | narimiran | btw, that's how i started — translating my python AoC solutions to nim |
15:59:54 | FromDiscord_ | <moerm> absolutejam Keep it simple! If you are happy, laud Araq and the Nim team. If you are not, blame me *g |
16:00:04 | FromGitter | <mratsim> > _> |
16:00:08 | narimiran | and when nim solutions weren't much faster — i knew it is time to ask questions, because i was doing something wrong :) |
16:00:14 | FromGitter | <mratsim> You sound like the Rust Evangelisation Team :P |
16:00:44 | FromDiscord_ | <moerm> Who? narimiran? |
16:00:46 | absolutejam | AoC? |
16:00:50 | FromGitter | <mratsim> you moerm :P |
16:00:54 | narimiran | absolutejam: advent of code |
16:00:57 | FromGitter | <mratsim> oC = Advent of Code |
16:00:58 | absolutejam | ah |
16:01:25 | FromGitter | <mratsim> https://adventofcode.com/2018/day/1 |
16:01:47 | narimiran | btw, 2018 was way harder than 2017. start with 2017, IMO |
16:02:38 | FromDiscord_ | <moerm> mratsim I *actually* would take that as an insult (I *strongly dislike Rust) but knowing how you meant it I'm smiling. Thanks |
16:03:39 | FromDiscord_ | <moerm> But seriously, I'm *not* evangelizing. I simply speak of my (largely very good) personal experience |
16:04:10 | absolutejam | is Nim funded or backed? |
16:04:28 | PMunch | absolutejam, it does receive some funding from companies |
16:04:35 | PMunch | And donations from regular people |
16:04:37 | absolutejam | Just reading about languages in the last few days and I saw Mozilla are backing Rust vs. some of the smaller projects with no funding |
16:04:42 | absolutejam | cool, just curious |
16:04:45 | FromGitter | <mratsim> https://nim-lang.org/blog/2018/08/07/nim-partners-with-status.html |
16:04:48 | absolutejam | in no situation to contribute, sorry ;) |
16:04:52 | FromDiscord_ | <moerm> Yes, but in small scale and *not* by a large corp/org - which is a *good* thing in my eyes |
16:05:01 | PMunch | https://nim-lang.org/sponsors.html |
16:05:19 | absolutejam | You mean, you don't want Microsoft Nim? |
16:05:21 | FromGitter | <mratsim> ^ah right that was the page I was looking for |
16:05:24 | absolutejam | Microsoft Nim Studio 2019* |
16:05:34 | * | PMunch shudders |
16:05:37 | absolutejam | System Center Nim Manager 2019 R2 |
16:05:38 | FromDiscord_ | <moerm> I don't want Mozilla Nim. |
16:05:53 | FromGitter | <alehander42> @Araq hm interesting i was trying to think of smarter alias-restricting annotations last week |
16:05:59 | narimiran | @moerm i think you don't have to worry about that :P |
16:06:00 | FromGitter | <alehander42> have to take a look at ada |
16:06:03 | FromGitter | <alehander42> spark |
16:06:09 | absolutejam | I get out of the Windows world forever at the end of the month. Can't wait |
16:06:14 | * | nim-newb joined #nim |
16:06:18 | FromGitter | <alehander42> is this like a dialect/subset of ada? |
16:06:25 | FromDiscord_ | <moerm> I also wouldn't like MS Nim ... but I do see that MS actually has done some very good things wrt languages and safety |
16:06:28 | Araq | subset |
16:06:36 | FromGitter | <mratsim> I’m going back to the windows and Linux world in the weekend :P |
16:07:14 | Araq | you can run Nim on Haiku |
16:07:31 | Araq | and it's Haiku's official scripting/application language. |
16:07:37 | FromDiscord_ | <moerm> alehandler I *come* from Ada/Spark and still use it for very sensitive stuff. But I can tell you that working in Ada/Spark is A LOT harder and more burdensome and less convenient than with Nim |
16:07:45 | Araq | nah, I'm kidding :D |
16:08:06 | Araq | moerm: hmm now you have my attention |
16:08:19 | FromDiscord_ | <moerm> Hmm? |
16:08:28 | narimiran | Ada is the magic word |
16:08:49 | FromGitter | <mratsim> Actually during Fosdem 2018 we got a lot of attentions from Ada devs |
16:08:58 | FromDiscord_ | <moerm> The *really good stuff* imo is Spark and computer aided verification |
16:09:02 | Araq | I studied it more during my holidays and found plenty of stuff to steal from it and I'm beginning to understand how a NimZ3 could work |
16:09:16 | FromGitter | <alehander42> moerm: oh probably, I am just interested in this from my langdesign-hobbyist point |
16:09:18 | PMunch | alehander42, if you are going to FOSDEM I recommend the Ada dev room. Nice beginner talks on Ada |
16:09:27 | * | jxy quit (Ping timeout: 240 seconds) |
16:09:37 | PMunch | NimZ2? |
16:09:40 | PMunch | 3* |
16:09:43 | FromDiscord_ | <moerm> mratsim I'm not in the least surprised. Nim is a very very attractive route for many or even most jobs that Ada devs do |
16:10:07 | stefanos82 | PMunch: like Dragonball Z, but for Nim |
16:10:27 | Araq | PMunch: Nim combined with the Z3 verification engine |
16:10:28 | FromGitter | <alehander42> @PMunch : yes, I am: thanks for the recommendation, i'll take a look at their program |
16:10:29 | * | jxy joined #nim |
16:10:38 | FromDiscord_ | <moerm> Araq Now you see a REALLY BIG smile on my face. The idea that Nim should (at some point later) be hooked up to Z3 is hunting me since weeks |
16:11:02 | FromDiscord_ | <moerm> Hint: Have a look at boogie. Makes it easier and keeps some more paths open |
16:12:03 | FromDiscord_ | <moerm> "Nim combined with the Z3 verification engine" - that would be a killer thing. It would push Nim into another league and create lots of distance to Rust, Crystal, etc. |
16:12:32 | FromDiscord_ | <moerm> Plus: Look at ats, idris, agda, etc. Way to FP for many devs and way too complicated |
16:12:37 | nim-newb | Hey guys, sorry to interrupt. I want to learn Nim and just wanted to come by and ask if "Nim in Action" is still a good reference or if it's outdated by now with the recent releases? |
16:13:00 | narimiran | nim-newb: still good, not outdated |
16:13:05 | FromGitter | <mratsim> not outdated, the example are used as anti-regression tests |
16:13:05 | FromDiscord_ | <moerm> The real killer trick (that is possible with Z3) is to make it *accessible* and *convenient* to many devs |
16:13:14 | nim-newb | Thanks! |
16:13:23 | FromDiscord_ | <moerm> nim-newb YES it is |
16:15:22 | FromDiscord_ | <moerm> Re *How* to do it: Start with design by contract. Simple pre and post conditions, some basic invariants esp. for data, loops, etc |
16:15:57 | FromDiscord_ | <moerm> You can (and probably should) use something similar to Ada's (elegant and good) "where" style |
16:17:05 | FromGitter | <mratsim> for design by contracts, I find this lib quite elegant: https://github.com/Udiknedormin/NimContracts |
16:17:07 | FromDiscord_ | <moerm> And the best thing: a) contracts for Nim already exist (macro based) albeit a bit crude, but hey, it's a start. And b) Nim *actually does* already perform many checks that would beg to be done via an SMT like Z3 |
16:18:04 | * | nim-newb quit (Quit: Page closed) |
16:18:12 | FromDiscord_ | <moerm> And: DbC is THE classical entrance to verifiable code. Ada did it that way too. One could even say that Spark is largely Hoare triples added to Ada |
16:19:05 | Araq | yup |
16:19:28 | FromDiscord_ | <moerm> The bad side: Separation logic isn't easy to implement or to use. But the good news is that Nim is largely not concerned due to mostly ref (instead of pointers) |
16:20:01 | FromDiscord_ | <moerm> So, in summary, formal verif. would be well feasible and not too hard for Nim |
16:20:16 | Araq | moerm: My plan was to allow for "vendor" specific pragmas that Nim ignores but NimZ3 uses |
16:20:38 | FromDiscord_ | <moerm> modulo ``ptr`` but those are anyway kind of "if you use them you're on your own" already |
16:21:49 | * | absolutejam quit (Ping timeout: 246 seconds) |
16:22:16 | FromDiscord_ | <moerm> Araq Hmmm that's similar to the classic annotation approach. That's a good approach, in particular if NimZ3 does it more like Ada (not comments but a real part of the language). And yes, it should be feasible to treat those in Nim std. simply as "empty macros" |
16:23:12 | Araq | well it's crucial to annotate proc *types* with them, not use proc bodies. We can always add more keywords to the language later... |
16:23:16 | * | BigEpsilon quit (Ping timeout: 250 seconds) |
16:23:36 | * | nc-x joined #nim |
16:23:42 | FromDiscord_ | <moerm> Btw Again, Nim already *does* some limited stuff that is typically in the formal verif. camp. Example: subranges (which are basically data invariants) |
16:24:07 | Araq | I have a branch where Nim proves array indexing correct or warns if it can't |
16:24:42 | FromDiscord_ | <moerm> Araq Yes, but pre and post conditions are on proc types anyway. Only invariants (e.g. typ. case loop invars) are within the body |
16:24:48 | Araq | uses a homegrown proof engine though, using Z3 instead is a natural thing to do |
16:25:23 | FromDiscord_ | <moerm> Araq Yes, absolutely. Stay away from homegrown engines and use Z3, either directly or via boogie |
16:25:54 | FromDiscord_ | <moerm> (I'm notg sure that boogie runs on non-windows though. Would need to look that up) |
16:27:06 | FromDiscord_ | <moerm> Another point I'd suggest to think about is how much can be done using Nims CT capabilities. I don't know them well enough to make a tenable statement yet but I have a hunch that that might be interesting to ponder |
16:28:11 | FromGitter | <alehander42> I agree, pre/post conditions are ct expressions that can be hypothetically part of a signature |
16:28:45 | FromDiscord_ | <moerm> One point to keep in mind however is that Z3 does *not* look whether a proposition is true. Rather it usually looks whether it can find a counter example. A small detail it might seem but should keep it in mnd |
16:29:13 | * | nc-x quit (Quit: Page closed) |
16:29:41 | FromGitter | <mratsim> the array indexing proving is already used in teh parallel statement no? |
16:29:42 | FromDiscord_ | <moerm> alehandler I guess so. But my expertise with Nim doesn't yet allow me to make strong statements about CT for FV/dbC |
16:30:42 | FromGitter | <mratsim> there are some interested: https://github.com/Udiknedormin/NimContracts/issues/4 |
16:31:13 | Araq | mratsim: correct but I only recently made it more stable |
16:31:56 | * | dom96_w joined #nim |
16:32:00 | dom96_w | https://fosdem.org/2019/schedule/event/nim_metaprogramming/ :D |
16:32:02 | dom96_w | CC PMunch |
16:32:05 | Araq | moerm: well as I said, I think I figured out how to do this during christmas |
16:32:25 | FromDiscord_ | <moerm> Araq GREAT! |
16:32:30 | Araq | but I'm busy with other things, however, I can guide you *if* you find the time for it |
16:32:51 | PMunch | dom96_w :) |
16:32:57 | FromDiscord_ | <moerm> Araq right now I don't have the time 😦 |
16:33:13 | Araq | ok, ping me when you do please :-) |
16:33:21 | narimiran | congrats PMunch |
16:33:28 | PMunch | Thanks :) |
16:33:39 | PMunch | Now just to write the talk :P |
16:33:43 | FromDiscord_ | <moerm> Araq will do. But keep in mind that I'm still just a "grasshopper" in Nim and far away from mastery |
16:34:11 | Araq | doesn't matter much to me. as long as you stay and know Ada Spark. |
16:34:50 | FromDiscord_ | <moerm> Haha, Spark was and is *the* reason I still love Ada. |
16:36:29 | * | floppydh quit (Quit: WeeChat 2.3) |
16:37:37 | FromDiscord_ | <moerm> We should btw find a better solution than Spark in one point: Not to have to create large condition "snakes" but to have a nicer syntax; something like "where chains" |
16:39:57 | FromDiscord_ | <moerm> like "where required A, required B, required C and D" (Note the commas) and maybe "pre" and "post" instead of "required" and "ensured". |
16:40:49 | FromDiscord_ | <moerm> And, important: A way to to have "CT only" or CT and RT" |
16:43:55 | Araq | I can't follow you unfortunately |
16:45:17 | FromDiscord_ | <moerm> Don't worry, just details (albeit significant ones). For now the important point is to offer the conditions to be checked only CT or both CT and RT. Experience tought me that some granularity there is strongly desirable |
16:46:23 | FromDiscord_ | <moerm> Probably easy to handle by a simple pragma like "require {.rtcheck.} some_proposition" |
16:47:25 | Araq | huh? that's an "assume" in my book |
16:47:34 | FromDiscord_ | <moerm> The only "problem" is that CT is about formal verification while RT means to actually create code (which Nim does anyway already in many cases). But it's quite different beasts |
16:47:57 | Araq | exactly. I'm talking about verification. |
16:48:20 | Araq | if you can't prove it, you need to *assume* it |
16:48:30 | Araq | and assumptions work better when checked at runtime ;-) |
16:49:00 | * | cspar_ quit (Ping timeout: 246 seconds) |
16:49:01 | FromDiscord_ | <moerm> I personally would advise against mixing up/mangling concepts. A CT require is for Z3 proving, a RT require is for creating RT checks. |
16:49:22 | FromDiscord_ | <moerm> Yes, you are right from a language point of view |
16:49:43 | FromDiscord_ | <moerm> But you can not verify everything at CT |
16:49:46 | Araq | well yes, I agree. I'm not mixing them up, I intend to use different verbs for them |
16:50:08 | Araq | have a look please: https://rise4fun.com/Boogie/4OVU |
16:50:27 | Araq | am I dumb or is it the tool? |
16:50:27 | * | dom96_w quit (Quit: Textual IRC Client: www.textualapp.com) |
16:51:00 | Araq | oh it's me, never mind |
16:51:12 | Araq | silly typo :D |
16:52:01 | FromDiscord_ | <moerm> That's easy to pardon because the example there is somewhat nonsensical *g |
16:52:28 | Araq | not really, I checked how well the tool understands mutable locals |
16:53:17 | FromDiscord_ | <moerm> More important probably: Is it windows only and MIT/BSD licensed? |
16:53:42 | FromDiscord_ | <moerm> (MS is not really consistent wrt their open source) |
16:55:03 | Araq | "Microsoft Public License (Ms-PL)" |
16:55:11 | Araq | and it uses Mono/.NET |
16:55:35 | FromDiscord_ | <moerm> And: I don't particularly like your choice of verbs because "assume" in the formal verif world usually is used a hint to the verifier |
16:56:19 | Araq | but that's what it is, the verifier may assume it, we need to emit a runtime check |
16:56:34 | FromDiscord_ | <moerm> Yuck, Mono/.NET probably means that we'll have to address Z3 directly. I hoped that we can use boogie but that seems to not make sense |
16:57:12 | Araq | maybe we can get away with their web service for a start :P |
16:57:32 | Araq | the license appears to be MIT compatible |
16:57:47 | * | tiorock joined #nim |
16:57:47 | * | rockcavera quit (Killed (tepper.freenode.net (Nickname regained by services))) |
16:57:47 | * | tiorock is now known as rockcavera |
16:57:47 | * | rockcavera quit (Changing host) |
16:57:47 | * | rockcavera joined #nim |
16:57:56 | FromDiscord_ | <moerm> (No. You are looking from a PL perspective. "assume" simply means a "hint" to the verifier. A typical case would be that 0 *is* in the domain but a rare case) |
16:58:13 | FromDiscord_ | <moerm> their web service? Tsss. |
16:58:45 | FromDiscord_ | <moerm> No, if we do it (and we definitely should!) we should do it properly and right. |
16:59:11 | Araq | yuck it uses the visitor pattern |
16:59:14 | FromDiscord_ | <moerm> which unfortunately means to use Z3 directly, sigh. Feasible but a lot harder |
16:59:25 | FromDiscord_ | <moerm> *laughing* |
16:59:55 | FromDiscord_ | <moerm> (I usually try hard to stay away from commenting on web related things...) |
17:00:55 | FromDiscord_ | <moerm> I don't know a lot about the Nim compiler yet. Do we have something like SSAs (similar to clang)? If so that would be useful |
17:02:56 | Araq | unfortunately not but it's not a big deal, I know how to deal with mutability |
17:03:47 | Araq | Boogie also uses a weird lexer and parser |
17:04:55 | FromDiscord_ | <moerm> Yes but that's not the point. SMT solvers usually digest propositions very similar to what a compiler's SSAs provide |
17:06:43 | FromDiscord_ | <moerm> Maybe our LLVM backend might be useful Dunno, will have to look and check |
17:08:33 | Araq | I fail to see the point, I think I can translate Nim into propositions, but I cannot solve the propositions |
17:08:59 | FromDiscord_ | <moerm> Then we have no significant problem |
17:09:49 | * | Vladar joined #nim |
17:10:39 | FromDiscord_ | <moerm> Reason: No, what a compiler produces are rarely really useable (for a verifier) propositions - but: if you give me something looking like propositions (and links into the AST) I should be able to make those into Z3 grokable requests |
17:11:25 | FromDiscord_ | <moerm> Disclaimer: This is not a promise. It's merely "loud thinking" (albeit based on quite experience) |
17:11:49 | Araq | ok, got it, seems like you know the other puzzle piece |
17:13:09 | FromDiscord_ | <moerm> Yes |
17:13:38 | FromDiscord_ | <moerm> But just a grasshopper in Nim, not knowing many relevant things |
17:14:20 | Araq | I could make the compiler output a JSON file with the propositions and then you can lay a tool on top of it based on Z3 |
17:15:17 | FromDiscord_ | <moerm> Hmmm, that might be a reasonable way although in the end/later we should some up with an on the fly solution |
17:15:29 | FromDiscord_ | <moerm> But it's a good starting point I guess |
17:15:42 | FromDiscord_ | <moerm> -some + come |
17:16:36 | Araq | well JSON doesn't really mean anything, unfortunately |
17:17:02 | Araq | the format still would be adhoc |
17:17:15 | Araq | and ultimately pointless, might as well generate Z3 syntax |
17:17:44 | FromDiscord_ | <moerm> I'd imagine something with (quite granular) compiler calls to which the verif. engine would respond with a tuple of bool (OK, not OK) and a string with some problem/error description. |
17:18:05 | FromDiscord_ | <moerm> (Yes, I was hesitating also when you brought up JSON) |
17:19:03 | FromDiscord_ | <moerm> (would create 2 additional steps without offering a lot of candy) |
17:19:27 | * | dorelix quit (Ping timeout: 246 seconds) |
17:20:42 | FromDiscord_ | <moerm> just give a reasonable representation of the propsitions along with some (mainly type) info |
17:21:22 | FromDiscord_ | <moerm> My orientation point would something like LLVM IR |
17:21:56 | FromDiscord_ | <moerm> Those could be pre evaluated and with a little massaging be handed to Z3 |
17:22:13 | Araq | I can output some adhoc stuff and then you hit me with a stick until it's Z3 syntax or at least useful |
17:22:34 | FromDiscord_ | <moerm> useful is good enough. Z3 syntax isn't needed |
17:23:27 | FromDiscord_ | <moerm> Maybe a simple loop invariant would be a good thing to look at for a start |
17:24:01 | Araq | already too much, I can give you array indexing problems though |
17:24:10 | Araq | like |
17:24:15 | FromDiscord_ | <moerm> I'd need the Index var and it's type along with eventual further constraints |
17:24:24 | FromDiscord_ | <moerm> Hmm? |
17:24:38 | Araq | we know: i >= 0 and i <= x-4 |
17:24:56 | Araq | question: does i <= x hold? |
17:24:58 | FromDiscord_ | <moerm> Then Z3's first question would be the domain of x |
17:25:06 | Araq | integers |
17:25:17 | FromDiscord_ | <moerm> Yes and no |
17:26:21 | Araq | what do you mean? |
17:26:39 | FromDiscord_ | <moerm> Today it's "integers. done". But with NimZ3 it could (and usually should) be integer with constraint (like "x \elem integer | 3 < x < 2000") |
17:27:15 | * | BigEpsilon joined #nim |
17:27:47 | FromDiscord_ | <moerm> and Z3 would try to find an example for which "i < x" does *not* hold |
17:29:18 | FromDiscord_ | <moerm> That's what we programmers often have a hard time to get. Formal Verif/SAT/SMT is basically about domains, co-domains, and some logic (often FOL) |
17:29:58 | Araq | well yes but I can translate 'var x: range[3..5]' into 'x >= 3 and x <= 5' |
17:30:03 | FromDiscord_ | <moerm> Have you ever worked (more than superficially) with formal modelling? |
17:30:34 | FromDiscord_ | <moerm> (Yes! and you SHOULD! because that's what I'll work with) |
17:30:50 | Araq | no. not at all. Only read about it. |
17:31:01 | FromDiscord_ | <moerm> something like TLA or (worst case *g Promela= |
17:31:09 | FromDiscord_ | <moerm> Hmm. Let me explain: |
17:32:20 | FromDiscord_ | <moerm> In a formal modeller you do something like coding. But it's really all about constraints. You are basically care about the data mainly. It's not about the code |
17:32:46 | Araq | yeah I know, I also know there are other domains beyond the integers |
17:33:10 | FromDiscord_ | <moerm> It's in a way somewhat along the line of how a mathematician sees the world (and the result just "coincidentially" happens to be useful for software too) |
17:33:36 | Araq | and depending on the domain you have different axioms and rules |
17:33:53 | FromDiscord_ | <moerm> No, Araq, sorry, my clumsy wording. It's not about integers vs. floats and such. It's about *constraints*. |
17:34:21 | FromDiscord_ | <moerm> like when we were in school and the math teacher always terrorized us with "and what's the domain?" |
17:35:20 | FromDiscord_ | <moerm> The best clue is *how* I wrote it above. Example: x \elem N1 | such that 3 < x < 2000 |
17:36:05 | FromDiscord_ | <moerm> The "N1" (positive integers) is just a first "crude ballparl". The relevant part is what comes after the "such that"/"where" ('|') |
17:36:30 | Araq | hmm sure but I still don't understand why you emphasize that so much |
17:36:44 | FromDiscord_ | <moerm> Because that's what it's all about |
17:37:04 | Araq | the thing is, x < 2000 is not all that useful, usually it's at least x < N |
17:37:33 | FromDiscord_ | <moerm> Whatever x happens to be. It has boundaries and those are decisive |
17:37:52 | Araq | and then I don't know if y elem N1; x \elem N1 | such that 3 < x < y |
17:38:11 | FromDiscord_ | <moerm> And our problem is that it's usually not clear and simple. |
17:38:12 | Araq | helps the verifier that much |
17:38:43 | Araq | over the more imperative x < y stated as a separate fact |
17:39:02 | FromDiscord_ | <moerm> Thanks. That's one example. The verifier WILL look at the y domain - the value of y has probably been set who knows where in the code |
17:39:18 | FromDiscord_ | <moerm> That's why I asked for links to the AST |
17:40:11 | FromDiscord_ | <moerm> You just hand me the propsitions in a somewhat formalized way (just as you proposed). Then I will have to find the rest that's needed before I can feed Z3 |
17:40:11 | Araq | in my proof engine I translate range types into propositions about relations |
17:40:31 | Araq | bbs |
17:40:40 | FromDiscord_ | <moerm> "bbs"? |
17:42:06 | PMunch | Be Back Soon |
17:42:06 | * | Ven`` quit (Ping timeout: 252 seconds) |
17:42:35 | FromDiscord_ | <moerm> Thanks. Me chat stupid |
17:42:48 | FromGitter | <alehander42> i guess that moerm means that some similar engines operate on domains/constraints instead of `a op b` facts? |
17:42:51 | FromGitter | <alehander42> just guessing |
17:44:47 | FromDiscord_ | <moerm> Yes and no. Look, in real world code it's not handy primitive SSAs. ``b`` might come from who knows where. Think of it somewhat like an AST. You need to walk it along and find the domains and constraints to prepare something that Z3 can grok |
17:44:59 | * | rayman22201 joined #nim |
17:46:39 | FromGitter | <alehander42> so yeah in this case i think Araq's propositions should be relatively easy to convert to domains: i think technically that's what it models anyway |
17:47:06 | FromDiscord_ | <moerm> The op part is relatively simple. When, for instance op happens to be + Z3 can easily check that IF it has a clear and well defined (and constrained) domain |
17:47:31 | * | sheerluck quit (Quit: Leaving) |
17:47:34 | FromGitter | <alehander42> what i mean is more stuff like `a >= x a <= i` |
17:48:11 | FromDiscord_ | <moerm> Looks more complex but is basically the same thing. |
17:48:32 | FromGitter | <alehander42> i think one of the analysis that inspired the bound checking thing used sets to model the possible states of some properties, so the domain of the index is the obvious equivalent thing for bounds checking indeed |
17:50:09 | FromDiscord_ | <moerm> and would be transformed to ``(a >= x where a = <spec>, x = <spec>) and (a <= i where a = <spec>, i = <spec>)`` |
17:51:06 | FromDiscord_ | <moerm> There are some more things that add complexity, like for example quantors, but that's basically it |
17:53:02 | FromDiscord_ | <moerm> (*all* a >= x for a given context is very much different from *exists* a | a >= x) but that mainly Z3's problem not ours. We "just" have to prepare everything so that Z3 can grok it |
17:54:14 | FromDiscord_ | <moerm> But I'm extremely excited and pleased about Araq interest and plans. If we manage to pull that off, Nim will me in another league than the competition (incl. Rust)! |
17:54:19 | * | wildlander joined #nim |
17:54:32 | FromDiscord_ | <moerm> -me +be |
18:05:50 | FromDiscord_ | <moerm> I seem to have driven away everybody here. Apologies. I got carried away. |
18:06:42 | narimiran | :) |
18:06:49 | FromGitter | <alehander42> no, it's all very interesting, i guess that just people are away from pc around this time (leaving work etc) |
18:07:04 | narimiran | nah, he drove us away :P |
18:07:19 | FromGitter | <alehander42> i guess that existential constraints are more similar to generics |
18:10:28 | * | BigEpsilon quit (Ping timeout: 245 seconds) |
18:15:44 | * | shashlick_ joined #nim |
18:16:16 | * | BigEpsilon joined #nim |
18:17:18 | Araq | moerm: I'm back and I might give you something this weekend but I should really focus on other things |
18:18:14 | FromDiscord_ | <moerm> No prob. No need to hurry as I don't have lots of time on hand right now anyway |
18:18:54 | Araq | on the other hand, it's probably 1-4 hours of work for me, I have the propositions for my home grown "proof engine" already |
18:19:04 | FromDiscord_ | <moerm> But whatever you give to me will definitely help to think about it more concretely. and for that at least I should find some time |
18:19:26 | Araq | (if it can be called that) |
18:19:47 | * | NimBot joined #nim |
18:20:32 | Araq | and I can see problems ahead :-) for more general loop invariants |
18:20:45 | FromGitter | <alehander42> i'll be very interested to see how this develops as well |
18:21:46 | FromDiscord_ | <moerm> Araq yes, but then: Nim is among the best problem solving tools around *g |
18:22:13 | rayman22201 | +1 to that. I have followed formal tools like idris or SPARK only from afar, but I think the concept is really freaking cool. |
18:22:21 | FromDiscord_ | <moerm> I guess it will take some time and some refining iterations but it's achievable and it's extremely attractive |
18:22:26 | narimiran | @moerm offtopic, but what is that "*g" you're using at the end of some of your messages? |
18:22:55 | FromDiscord_ | <moerm> I have learned that *g stands for a friendly grin |
18:23:08 | Araq | of course the unwise thing to do is to reimplement the relevant stuff from Z3, it's a huge C++ project with unknown artificial complexity, as usual |
18:23:40 | FromDiscord_ | <moerm> rayman The trick - which seems feasible with Nim - is to make it *easy* and really accessible for normal developers |
18:23:57 | FromDiscord_ | <moerm> C++ (mistrusting unhappy look) |
18:24:00 | FromDiscord_ | <moerm> ? |
18:24:13 | Araq | yeah and for that the compiler devs need a deep understanding |
18:24:22 | Araq | which comes from reimplementing stuff |
18:24:35 | FromDiscord_ | <moerm> Oh, you are talking about Z3 and not about what you have done so far. I misunderstood you |
18:25:05 | Araq | yes. |
18:26:01 | * | nsf quit (Quit: WeeChat 2.3) |
18:26:03 | FromDiscord_ | <moerm> I know some projects where I can have a good close look. My (and I guess Araq's) target would be a *simple* (to use) yet true formal solution |
18:26:28 | Araq | I remember that SAT solvers used to work with BDDs |
18:26:47 | Araq | is that still the case? |
18:27:43 | FromDiscord_ | <moerm> Obviously - but that's the case everywhere - the result quality is depending on the input quality. So a dev hardly making the effort to nail his code down will have little outcome. But I think it would be an excellent result if one *could*, albeit with some more thought and effort, create seriously verified code |
18:27:55 | FromDiscord_ | <moerm> "BDD"? |
18:29:02 | Araq | "binary decision diagram" |
18:30:19 | FromDiscord_ | <moerm> Hmmm, depends. There are diverse paradigms. But frankly, I wasn't too interested in *how* SAT/SMT solvers work internally. But yes, certainly BDD and graph walkers are prominent |
18:32:35 | Araq | still a bit shocked that Z3 doesn't use Ocaml or similar as the implementation language |
18:32:58 | FromDiscord_ | <moerm> Araq How difficult is it to add more information to Nims internal representation or AST? |
18:33:17 | FromDiscord_ | <moerm> re ocaml -> performance reasons I guess |
18:33:47 | Araq | what do you mean "more information"? the AST is typed and has precise line information throughout the compilation pipeline |
18:33:48 | FromGitter | <alehander42> Ocaml is pretty fast |
18:34:27 | FromGitter | <alehander42> I guess it just wasn't so popular back then when they wrote it |
18:34:43 | FromDiscord_ | <moerm> I'm asking because somewhere I'll need additional info on constraints. If we don't want to have that in the AST I'lll basically need to have a second one for my sub-pass |
18:34:59 | Araq | hmm I remember lots of stuff about BDDs that I learned at university |
18:35:26 | FromDiscord_ | <moerm> Example: I would need for *any and every* integer it's (potentially constrained* domain |
18:35:41 | Araq | yeah I know, that's not a problem |
18:36:05 | FromDiscord_ | <moerm> (I remember a lot too but I'm still not really interested to know a lot about the inner working of Z3) |
18:36:57 | FromDiscord_ | <moerm> also constrained types (we already have that e.g. as subranges) but those are typical for that kind of prgramming. You nail things down early |
18:37:36 | * | Trustable joined #nim |
18:37:54 | FromDiscord_ | <moerm> OK, if you say that's not a problem I'm a happy man. Then it's good enough to pass links to the AST along for the "pre propositions" you create and pass to my sub-pass |
18:38:29 | FromDiscord_ | <moerm> And 'll have to learn a whole lot more about Nim and way faster than I had planned, sigh |
18:38:52 | Araq | problem is that I have no clue whatsoever how to map anything to SAT :-) |
18:39:42 | Araq | for example, it I know 'a = b', what to translate that into? 'if a: b elif b: a else: false' ? |
18:39:45 | Araq | *if |
18:39:56 | * | BigEpsilon quit (Ping timeout: 272 seconds) |
18:39:58 | FromDiscord_ | <moerm> Don't. Just pass me the propositions and the broken down instructions |
18:40:35 | Araq | BDDs only understand boolean algebra |
18:40:44 | FromDiscord_ | <moerm> "I" == the developer knowing his stuff? Or you, the compiler writer? |
18:40:57 | Araq | me, the compiler writer. |
18:41:27 | FromDiscord_ | <moerm> Then you just pass me "a == b" as a valid premise |
18:41:49 | Araq | don't misunderstand me |
18:41:57 | FromDiscord_ | <moerm> hmm? |
18:41:57 | Araq | I'm asking how Z3 works under the hood |
18:42:40 | FromDiscord_ | <moerm> Why? Do you want to implement a solver, a Nim version of Z3? |
18:43:27 | FromDiscord_ | <moerm> (I'm a bit afraid the answer from Araq might be "Yes" *g) |
18:44:02 | Araq | why not, as I said, things work out better when you understand the technology |
18:44:45 | FromDiscord_ | <moerm> I agree. But things also work out a LOT slower when every wheel is re-implemented |
18:44:57 | Araq | and even I don't implement anything I still want to know how it works |
18:45:50 | FromDiscord_ | <moerm> There has been LOTS of work on SAT and later on SMT solvers. I guess re-implementing it would be a project the size of Nim itself |
18:46:42 | FromDiscord_ | <moerm> I would strongly suggest to simply use it and be done. (besides profoundly studying it if you are interested of course) |
18:49:00 | Araq | don't you worry, there is nothing wrong with being curious |
18:49:31 | FromDiscord_ | <moerm> Full ACK. My point is just *implementing* our own Z3 |
18:49:46 | FromDiscord_ | <moerm> *That* is what I'm opposed to |
18:50:34 | FromGitter | <alehander42> I agree, I think it's best to play/prototype with several different solvers and learn their strengths, maybe one can even come up with something novel |
18:51:02 | * | absolutejam joined #nim |
18:51:34 | absolutejam | is there a lazy-man's form of concurrency in Nim, a la go routines/fibers? |
18:51:48 | leorize | yep, threadpool |
18:51:57 | absolutejam | Is that using traditional threads? |
18:52:24 | FromDiscord_ | <moerm> Later that might indeed a good idea. After all it should be a lot easier to do something like that in Nim. Right now, though, I would fully bet on just using Z3. One reason being that we (Nim) still is somewhat of an outsider while Z3 ist THE "standard" and has a high reputation. |
18:52:31 | absolutejam | Just curious. I can't say I know enough about other language implementations - or the real world implications - to compare, just curious |
18:52:35 | Araq | I figured that SMT is not the same as SAT and indeed they don't resolve 'a = b' at all |
18:52:38 | absolutejam | Apparently I'm double curious |
18:52:50 | leorize | yea, or you can go async for single-threaded |
18:53:12 | * | jxy quit (Ping timeout: 250 seconds) |
18:53:33 | FromDiscord_ | <moerm> If we (at least now and for some time to come) came up with our own "Z3" we would get but mistrust and frankly, often lack of interest. Trust me, I know that community quite well. |
18:53:57 | * | jxy joined #nim |
18:53:57 | FromDiscord_ | <moerm> Araq Yes, SMT != SAT |
18:54:36 | FromDiscord_ | <moerm> And yes they don't *resolve* ``a == b`` - but they use it as something "assume" like |
18:54:45 | Araq | btw https://github.com/nim-lang/Nim/blob/devel/compiler/guards.nim#L832 seems like I wrote a shitty SMT without noticing |
18:54:53 | absolutejam | Frantically googling Z3 |
18:55:17 | rayman22201 | @absolutejam: https://github.com/Z3Prover/z3 |
18:55:27 | absolutejam | https://medium.com/@ahelwer/checking-firewall-equivalence-with-z3-c2efe5051c8f - this guy has closing parens on its own line |
18:55:35 | absolutejam | call the lisp police |
18:56:38 | Araq | but I didn't know what I was doing thus it's unprincipled |
18:57:23 | FromDiscord_ | <moerm> Araq I'll stay away from judging your work; I'll simply leaving it at saying that I'm not surprised that you though along those lines. And I greatly like it |
18:59:24 | FromDiscord_ | <moerm> But I'll also underline again that many (in the formal verif camp) are very mistrusting. "we have Z3 verification" is a statement with weight. "We have created our own solver" however will not lead to much (in that camp) |
19:01:15 | FromDiscord_ | <moerm> Being at that: If you feel that you want to bring closer to those people and don't mind lots of work, we might want to have a look at getting some formal modeller to generate valid Nim code from models. It's available for C and some more esoteric language. To have it for Nim for be very very cool |
19:01:27 | rayman22201 | kind of makes sense. The whole point of formal verification is "trust" in a sense. Similar to how crypto people don't trust re-implementing crypto algorithms. |
19:02:50 | FromDiscord_ | <moerm> rayman They do - if they can immediately recognize that one knew bloody well what one was doing. What they don't accept though is crypto implementations that aren't *obviously* professional |
19:03:17 | Calinou | https://github.com/nim-lang/nimble#nimble-install |
19:03:23 | FromDiscord_ | <moerm> As for VF you are right. Z3 is like a seal of quality |
19:03:49 | Calinou | I wondered about nimble install, could it be made to fetch the latest version from the .nimble file instead of inferring it from the latest VCS tag date? (according to the description, I haven't tried it) |
19:04:14 | Calinou | I'd like to make continuous CI builds of my projects (uploaded to GitHub Releases), which requires creating a `continuous` tag that will almost always be the newest tag (compared to stable release tags) |
19:04:31 | Calinou | but if I do that, then people doing a `nimble install` would install the latest continuous version, not the stable release |
19:04:54 | Calinou | (I know it's easy to install Nim and Nimble if someone wants to try out Git HEAD, but not everyone wants to) |
19:05:39 | FromDiscord_ | <moerm> Z3 is a bit like Ada. It radiates trust |
19:05:56 | absolutejam | is there an idiomatic name for a method's 'self' parameter? |
19:06:23 | absolutejam | / proc |
19:09:21 | shashlick | Calinou - probably not how it is today |
19:09:35 | shashlick | not sure if it will help with nimble but perhaps create tags on a branch instead? |
19:10:19 | shashlick | also perhaps nimble looks for a.b.c versions and skips others but that is probably not the case |
19:17:57 | Araq | moerm: I completely agree with you, even if we produced something "better" than Z3, I wouldn't trust it either :D |
19:19:38 | FromDiscord_ | <moerm> *g |
19:20:02 | FromDiscord_ | <moerm> From what I see the main points are 2: |
19:20:26 | FromDiscord_ | <moerm> a) what is available is way too complex (and often immature) for the average dev. |
19:21:10 | FromDiscord_ | <moerm> b) The security nightmare isn't due to 0.1% of super elusive bugs. It's due to 99% crappy code |
19:21:30 | FromDiscord_ | <moerm> connect the two and you have recipe for success |
19:22:25 | FromDiscord_ | <moerm> Nim is in an excellent position for that. With Z3. That's what's needed. Now. |
19:23:24 | FromDiscord_ | <moerm> Besides other results Z3 will add credibility to Nim. |
19:24:07 | FromDiscord_ | <moerm> And now I'll stop before I get carried away again *g. I'll leave it at saying how delighted I am by your interest in that field |
19:25:37 | FromDiscord_ | <moerm> (And: please at least keep my modeller proposition somewhere in your head, even though that's probably for the future) |
19:25:55 | Araq | modeller proposition? |
19:26:15 | * | xet7 joined #nim |
19:27:14 | FromDiscord_ | <moerm> A good formal modeller creating Nim code from a model |
19:28:01 | FromDiscord_ | <moerm> "The safest and most comfortable way to create really, really good (as in "safe") code ... for NimZ3" |
19:28:22 | FromDiscord_ | <moerm> The point is to cover the whole cycle from modelling to verification |
19:38:25 | * | Marumoto joined #nim |
19:39:30 | * | nevermind joined #nim |
19:41:30 | Araq | that's beyond my capabilities |
19:42:23 | Araq | one more question: how do you deal with integer overflows? |
19:42:38 | Araq | generally, in Ada Spark. |
19:43:51 | FromDiscord_ | <moerm> The point is about having them at all in the first place |
19:44:34 | FromDiscord_ | <moerm> And: No, that's certainly not beyond your capabilies. Actually you already did something very comparable 😉 |
19:44:56 | FromDiscord_ | <moerm> But that thing was anyway just a long term idea. No need to worry |
19:45:39 | FromDiscord_ | <moerm> oops. + "NOT having them ..." |
19:47:17 | FromDiscord_ | <moerm> (and in plain Ada (no Spark) it would trigger an exception just like in other languages) |
19:51:59 | Araq | yes I know in Ada it raises an exception, how much of these can Spark prove to not happen |
19:52:05 | Araq | roughly speaking of course |
19:59:52 | FromGitter | <verilog15> Hi guys, someone is here? |
20:00:19 | Calinou | @verilog15 yes, ask your question :) |
20:00:51 | FromGitter | <jaguilar> Friends: I have a newb question. Is there a way to take a temporary reference to an element of an array? Something similar to the following C++: ⏎ ⏎ auto& foo = array[5]; ⏎ foo = "bar"; ⏎ std::cout << array[5]; // Prints "bar" [https://gitter.im/nim-lang/Nim?at=5c3652f34ed1827877851f4e] |
20:00:56 | FromGitter | <kaushalmodi> Hello, umm @verilog15 .. I deal with (System)Verilog too |
20:01:09 | FromGitter | <verilog15> I was wondering if Nim has pointer arithmetic as in C? |
20:03:29 | FromGitter | <verilog15> Consider the following piece of code in C I found about pointer arithmetic. Is it possible to do something similar (with pointers) in Nim? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c365391bd592b2e6e7a9a95] |
20:07:04 | FromGitter | <verilog15> Or maybe this method: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Is it possible to do so in Nim? (with pointers) [https://gitter.im/nim-lang/Nim?at=5c3654686370df0b91b6bcb9] |
20:10:06 | FromGitter | <jaguilar> I think nim explicitly disallows pointer arithmetic. It is on the feature list. |
20:10:07 | FromGitter | <jaguilar> https://github.com/nim-lang/Nim/wiki/Nim-for-C-programmers#philosophy |
20:10:25 | * | absolutejam quit (Read error: Connection reset by peer) |
20:11:11 | Zevv | no, it's perfectly possible |
20:11:28 | FromGitter | <jaguilar> Oh. My mistake then. |
20:12:04 | Zevv | but your entering the "unsafe" realms of the language |
20:13:38 | FromGitter | <jaguilar> Perhaps an additional useful data point is that pointer arithmetic is rarely a good idea |
20:13:47 | FromGitter | <jaguilar> Even in C |
20:13:56 | FromGitter | <jaguilar> it's a source of an incredible number of security bugs |
20:14:30 | FromGitter | <jaguilar> It's often less confusing to use array[offset] style instead |
20:14:39 | FromGitter | <jaguilar> and increment the offset rather than the array pointer. |
20:16:46 | * | zachk joined #nim |
20:18:18 | FromGitter | <verilog15> I know that it is not recommended and that is why Nim was created in the first place. I'm just looking for a fair easy example which proves that there is pointer arithmetic in Nim, for study purposes |
20:18:37 | * | absolutejam joined #nim |
20:19:10 | * | zachk quit (Changing host) |
20:19:10 | * | zachk joined #nim |
20:19:11 | Araq | var p = cast[ptr UncheckedArray[T]](addr someThing) |
20:19:12 | Zevv | http://paste.debian.net/1059450/ |
20:19:14 | Araq | p[i] |
20:19:17 | Zevv | don't try this at home |
20:21:13 | FromGitter | <verilog15> Oh great! thank you very much. Is it the same as the one I wrote in C? |
20:21:30 | Zevv | more or less |
20:22:13 | Zevv | p1 gets you a ByteAddress pointing to the first character of the string. ByteAddress is a type allowing you to do arithmatic with. |
20:22:38 | Zevv | the while checks if the poiner points to a char '\0', and increases otherwise |
20:22:39 | * | Trustable quit (Remote host closed the connection) |
20:23:40 | FromGitter | <kaushalmodi> @verilog15 I don't have experience with pointer arithmetic, but searching for this in nim forum yielded https://forum.nim-lang.org/t/1188#7366 |
20:24:05 | FromGitter | <kaushalmodi> May be Zevv can comment on that code |
20:25:18 | Zevv | the reason you can't do pointer arithmatice with 'normal' ptrs is that the basic operations like `+` and `-` are not available for them. These templates define those for you. |
20:25:26 | Zevv | But just don't go there :) |
20:27:56 | FromGitter | <jaguilar> According to the docs, nim will automatically dereference pointers and references via dot notation |
20:28:15 | FromGitter | <jaguilar> But I'm seeing an error when I try to do this, which is fixed by adding empty brackets |
20:28:37 | Araq | that's only done for fields, not for procs |
20:28:40 | FromGitter | <jaguilar> I.e. let foo = addr(bar[1]); foo[].action works |
20:28:44 | FromGitter | <jaguilar> but foo.action doesn't |
20:28:48 | Zevv | there is an experimental mode for that |
20:28:53 | FromGitter | <jaguilar> was this feature added recently? |
20:28:53 | Araq | action is not a field then |
20:29:31 | FromDiscord_ | <Obstinate> Ah, that only works for fields? |
20:29:34 | FromDiscord_ | <Obstinate> not functions? |
20:29:48 | Zevv | there is an experimental mode for that |
20:29:55 | Zevv | oh sorry, I ment: add {.experimental.} |
20:31:04 | FromGitter | <kaushalmodi> @jaguilar From my notes, this works: https://ptpb.pw/cj4J/nim |
20:31:34 | FromGitter | <kaushalmodi> `[]` is the dereferencing operator |
20:31:53 | FromDiscord_ | <Obstinate> I got it. I just thought it happened automatically. It turns out it does with {.experimental.} |
20:32:02 | * | zestyr joined #nim |
20:34:15 | FromGitter | <verilog15> Did they override the operators '+' and '-' so they would work on pointers in the following link?: https://forum.nim-lang.org/t/1188#7366 |
20:36:06 | Zevv | yes |
20:37:46 | absolutejam | I have to use parens for procs when I have multiple args right? |
20:37:50 | FromDiscord_ | <Obstinate> Is there a way to specify a "constructor" for tuples and such? |
20:37:59 | FromDiscord_ | <Obstinate> Or do I just write an "init" function |
20:38:35 | zestyr | no absolutejam, it's in the manual under "Command invocation syntax" |
20:38:35 | Zevv | I believe initSomething or newSomething is idiomatic indeed |
20:40:11 | Zevv | or just construct on the fly with (blah: 42, this: "that") syntax |
20:45:53 | * | absolutejam quit (Ping timeout: 245 seconds) |
20:46:13 | shashlick | Araq: size_t (uint) = csize, but what is ssize_t (int) |
20:46:38 | zestyr | signed size_t |
20:47:59 | FromGitter | <verilog15> does Nim has Automatic variable as in C? (Link to wiki: https://en.wikipedia.org/wiki/Automatic_variable?fbclid=IwAR11mTo2zdD8-j2cM-dt6bBYy6kIb2fhiVHPyp7xzQrghFK0-43pCFLBDCc) |
20:48:49 | narimiran | dom96: you here? any luck with that website server thingy? |
20:48:51 | * | absolutejam joined #nim |
20:49:28 | * | shashlick_ quit (Quit: The Lounge - https://thelounge.chat) |
20:52:05 | absolutejam | thanks for pointing that out zestyr |
20:52:17 | absolutejam | I was testing it but issue was I was trying to wrap in 'echo' |
20:52:34 | absolutejam | and obviously it doesn't like `echo(myproc "a" "b")` (as per docs) |
20:52:37 | * | ng0 joined #nim |
20:54:19 | FromGitter | <SolitudeSF> you still need commas, its not lisp |
20:55:21 | absolutejam | that was just a bad copy to IRC :P |
20:57:21 | shashlick | looks like this should be uint there - https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L1729 |
21:05:01 | FromGitter | <Varriount> @verilog15 Yes. |
21:05:49 | FromGitter | <Varriount> @verilog15 I have yet to see a procedural language (with scoped functions) that doesn't implement automatic variables. |
21:06:21 | * | banc quit (Quit: Bye) |
21:09:53 | FromGitter | <verilog15> @Varriount can you example or show with example? |
21:10:39 | * | narimiran quit (Quit: Leaving) |
21:11:00 | FromGitter | <verilog15> can you explain or show an example*. sorry :) |
21:14:20 | * | banc joined #nim |
21:14:27 | dom96 | narimiran[m]: fixed |
21:18:50 | FromGitter | <verilog15> In C each variable can be only in the scope: ⏎ ⏎ ```void main() {``` [https://gitter.im/nim-lang/Nim?at=5c36653a783a5553d80ad7a7] |
21:20:41 | FromGitter | <verilog15> In C each variable can be only in the scope: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ This will lead to fail. ... [https://gitter.im/nim-lang/Nim?at=5c3665a95aa04d46c584fbc1] |
21:24:23 | FromGitter | <kaushalmodi> @verilog15 something like this? |
21:24:27 | FromGitter | <kaushalmodi> ```let foo = 1 ⏎ block: ⏎ let bar = 2 ⏎ echo bar``` [https://gitter.im/nim-lang/Nim?at=5c36668b783a5553d80aded7] |
21:25:03 | FromGitter | <kaushalmodi> ^ above will fail with *Error: undeclared identifier: 'bar'* because `bar` is only in that block scope |
21:25:13 | FromGitter | <verilog15> yeah thanks! `foo` and `bar` are automatic variables right? |
21:25:24 | FromGitter | <kaushalmodi> sorry I am dumb when it comes to C |
21:25:44 | FromGitter | <kaushalmodi> you can compile the above and see in the nimcache to see what the compiled C looks like |
21:26:46 | FromGitter | <verilog15> It does, but if we speak about the definition of `automatic variables`, then `foo` and `bar` are both automatic variables? |
21:26:49 | * | krux02 quit (Remote host closed the connection) |
21:33:31 | FromGitter | <kaushalmodi> I don't know the low level jargon of how it's done in C. But yes, this compares to the automatic variables in SystemVerilog i.e. their lifetime expires once the scope ends |
21:34:50 | FromGitter | <verilog15> Great thank you |
21:35:47 | FromGitter | <verilog15> How Are NIM Arrays Represented In Memory? |
21:37:51 | dom96 | same as C arrays |
21:40:39 | FromGitter | <verilog15> with pointers? |
21:41:20 | * | vlad1777d__ quit (Ping timeout: 250 seconds) |
21:43:43 | FromGitter | <verilog15> What will happen if we will go out of arrays bounds? will the program end at that second or will it continue? |
21:45:34 | FromGitter | <kaushalmodi> @verilog15 the best way is to try it out |
21:45:39 | FromGitter | <kaushalmodi> Nim is a compiled language |
21:45:49 | FromGitter | <kaushalmodi> it won't even compile if things go out of bounds |
21:46:26 | FromGitter | <kaushalmodi> e.g. ⏎ ⏎ ```let foo = [1, 2] ⏎ echo foo[0] ⏎ echo foo[1] ⏎ # echo foo[2]``` ⏎ ⏎ works [https://gitter.im/nim-lang/Nim?at=5c366bb26a394e2821818240] |
21:46:55 | FromGitter | <kaushalmodi> but the moment you uncomment the last line, it won't even compile; you will get: `Error: index out of bounds: (a:0) <= (i:2) <= (b:1) ` |
21:50:29 | Calinou | I remember seeing something about array bounds checks being disabled in release mode |
21:50:43 | Calinou | I believe this doesn't impact compilation errors that might be thrown? |
21:52:14 | FromGitter | <kaushalmodi> Calinou: you are right! |
21:52:30 | FromGitter | <kaushalmodi> running with `-d:release` doesn't fail compile |
21:52:44 | FromGitter | <kaushalmodi> index 2 just rolls over to index 0 |
21:53:57 | FromGitter | <kaushalmodi> well. it is not rolling over |
21:54:09 | FromGitter | <kaushalmodi> it is just fetching arbitrary vals from memory |
21:54:19 | FromGitter | <kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c366d8a9289cc7aa74a931d] |
21:54:41 | FromGitter | <kaushalmodi> run with `-d:release` and I get: ⏎ ⏎ ```10 ⏎ 20 ⏎ 1 ⏎ 140733011305400 ⏎ 0``` [https://gitter.im/nim-lang/Nim?at=5c366da19289cc7aa74a9339] |
21:54:50 | FromGitter | <kaushalmodi> that's something good to know :) |
21:54:58 | * | zyklon quit (Read error: Connection reset by peer) |
21:57:15 | FromGitter | <kaushalmodi> one last thing on that topic .. you can pass `-d:release --boundChecks:on` to enable boundary checks in release mode too, and above snippet will fail |
21:59:42 | * | PMunch quit (Read error: Connection reset by peer) |
22:01:59 | FromGitter | <verilog15> what else `-d:release` do? |
22:09:01 | Calinou | uh, that's bad to hear :( |
22:09:12 | Calinou | this means you need to compile both in debug and release mode in CI to catch more bugs |
22:09:27 | Calinou | (if you want to produce optimized binaries for distribution) |
22:09:29 | FromGitter | <verilog15> Also can you point when was `-d:release` implemented? A link to the release notes would be nice. |
22:09:58 | zestyr | verilog15 just check the manual |
22:11:14 | zestyr | oh nevermind, the release option isn't documented there |
22:11:15 | * | zyklon joined #nim |
22:11:49 | FromGitter | <SolitudeSF> just look for `release` and `speed` https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg |
22:18:39 | Araq | yeah -d:release is pretty terrible :-) better use --stackTrace:off --opt:speed instead |
22:22:40 | * | koranza joined #nim |
22:22:58 | rayman22201 | @Calinou It's very common practice in the C/C++ world to have both a debug mode and release mode (and run CI on them) |
22:23:07 | FromGitter | <verilog15> what does Nimord stands for? |
22:23:25 | rayman22201 | https://en.wikipedia.org/wiki/Nimrod |
22:23:27 | Zevv | King Nimro |
22:23:28 | Zevv | d |
22:28:15 | Calinou | rayman22201: I know, also because in C++, null behavior depends on debug/release mode IIRC |
22:28:22 | Calinou | (good old bugs that disappear with a debug build) |
22:28:39 | Calinou | Araq: what's the performance difference like? |
22:31:45 | * | Vladar quit (Remote host closed the connection) |
22:39:57 | * | absolutejam quit (Ping timeout: 252 seconds) |
22:48:07 | Araq | feels the same to me :P |
22:50:32 | * | oculux joined #nim |
22:53:52 | * | oculux quit (Client Quit) |
22:56:06 | * | jxy quit (Remote host closed the connection) |
22:56:07 | * | zyklon quit (Read error: Connection reset by peer) |
22:56:57 | dom96 | shashlick: reviewed your PR. Sorry, there is a fair amount of changes |
22:59:53 | * | jxy joined #nim |
23:04:14 | shashlick | doesn't seem too unfair 🙂 |
23:11:08 | FromGitter | <timotheecour> @araq do u have 30 seconds? |
23:11:18 | * | oculux joined #nim |
23:13:25 | * | zyklon joined #nim |
23:21:41 | * | Ven`` joined #nim |
23:29:32 | dom96 | I wonder how big of a deal this is: https://gist.github.com/dom96/af65206852e17178a62a5265e05f2bce |
23:29:50 | dom96 | People on HN seemed to really think it was a disaster to be able to mutate the key of a table |
23:35:32 | FromGitter | <timotheecour> I think it enables real use cases though that overly strict rules of immutability wouldn’t allow; as it currently stands it requires programmer to make sure hash doesn’t change when key is mutated; I’m curious if there’s a way we can have both mutability of key and safety (or show warnings etc) by preventing hash from changing |
23:38:11 | FromDiscord_ | <moerm> Oops, I'm still here .. sorry, was absent. see you soon - and Thanks for todays discussion, Araq 😉 |
23:43:09 | * | nim-listener joined #nim |
23:43:18 | * | nim-listener quit (Client Quit) |
23:46:05 | FromGitter | <timotheecour> actually without reall immutability (in the D sense, not the weaker nim sense which is not really immutable), I don’t think there’s a way to design a table data structure that accepts arbitrary types as Keys and has immutable hashes |
23:46:13 | l1x | dom96: people think lots of crap on HNz |
23:46:34 | FromDiscord_ | <exelotl> Here's the result of today's experiments https://hastebin.com/raw/oyujayizub |
23:46:42 | l1x | dom96: question is how obvious is some behavior |
23:47:02 | rayman22201 | I could it see it being less of a "problem" if you could get the actual hash back out. Technically the internal hash is immutable. |
23:47:07 | FromDiscord_ | <exelotl> managed to get nim to generate something pretty close to the same C code I'd write by hand |
23:47:53 | FromDiscord_ | <exelotl> for initialising structs, and calling functions that take pointers to structs |
23:48:04 | FromGitter | <timotheecour> @rayman22201 what do u mean |
23:51:16 | rayman22201 | The way table is implemented uses the Hash type https://nim-lang.org/docs/hashes.html |
23:52:33 | rayman22201 | in Dom's example, if you changed the string back to the original "hello!" it would work again. |
23:53:16 | rayman22201 | or to put it another way, the hash function is pure. So in that way, the table keys are immutable. |
23:53:30 | FromGitter | <timotheecour> well but the safety concern is still a valid concern; personally i prefer the flexibility-at-expense-of-safety here but it’s a valid concern |
23:53:59 | rayman22201 | it's kind of a contrived example imo, but I agree with you @timotheecour |
23:54:20 | FromGitter | <timotheecour> > the table keys are immutable ⏎ ⏎ you do realize that nim’s immutability is not enforced, right? |
23:55:17 | * | stefanos82 quit (Remote host closed the connection) |
23:55:22 | rayman22201 | yes of course. |
23:56:50 | rayman22201 | I guess the safety is on par with C++ here I suppose. In that you can't get at the internal data structure of the table and change the hash values. But that's more about encapsulation than immutablity. |
23:56:51 | * | zyklon quit (Read error: Connection reset by peer) |