Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by mail-b.sr.ht (Postfix) with ESMTPS id 2F04EFF114 for <~duangle/scopes@lists.sr.ht>; Sat, 4 Jul 2020 22:30:56 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Mku6K4ag Received: by mail-qv1-f47.google.com with SMTP id t11so13660427qvk.1 for <~duangle/scopes@lists.sr.ht>; Sat, 04 Jul 2020 15:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:message-id:in-reply-to:references :mime-version; bh=/3UZXbrCyQ89vv5R0uTpW47pHQebYvnwFfr20X37XcQ=; b=Mku6K4agjSV715k9M/4ICKW8R07ael9JGjrF1zww2HRgfU7ldr+P60qC5Zi/tnIbXN Tdq5JNBx8tlRrsGwcfLVkvtRUbRLFjYjdysVUS3Ps4N16llus+rTq4jn+3IzuGSqWCO3 DtI+a8J3+XgPVze59ca77Ba/h5y8PSNCANWBqr+2MuU0f/NGpF17t7pWUq1+On1wWLlP srSk7hgcoKoRTOnf0pGAwzZrG9trEVLtX3CVRXecPSKDohWjSP2W7ajy4ghHp1kqcf+F r6H5lfVdW8kVZBP9GocW1UMfNzdPibojfFe16LhLblLkH+3bpZ/GmClUOadUGgh8IQPm 4Lzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:message-id:in-reply-to :references:mime-version; bh=/3UZXbrCyQ89vv5R0uTpW47pHQebYvnwFfr20X37XcQ=; b=ICpZdSpNmUj5AqcfPahuRY0Mq9OgbBoIls8C+DvxdNUWZLmzk69HsX8j842S6lnlQq 0f5KG3nyfaH1wUebM/ADKQFdy3oT2mq2Gm8SRRryVj8eFf9jgNA1dCRHzjwIrIAxojol befhTrVxzOG0PpOYduWA6Fj2kewpoiFSXsFFovoQFnjV1/pYyCv+TkdBv0QR1bD3+HyX 1b7aSdFNEQtHHGEYaXdbsE3RLlpf+dUxlH5sKP1W/fjsGJXx133CnEMfUPJpSxodqPjL jtKkgRkAqxN1PGEkf1bsvhP4AvypVr2KtRb7svKfB4/0XrKF5pjml7/HgeJAHzHB1ck/ rSyA== X-Gm-Message-State: AOAM530uIJl6jr8e5T+sS0KC8cNlomVkTgUPoaO/bGqMOWf4UJ2W3wAo jRvI0A/7cHPQ36uCWsBfTEM= X-Google-Smtp-Source: ABdhPJwFhHdyRqG6ciycBbAll1d6IayDyIPGhGXLKJ7JunMTQiABK8DsKAfqMmPZSE9HjMrJ1E8wDA== X-Received: by 2002:a0c:dd87:: with SMTP id v7mr38026067qvk.192.1593901855525; Sat, 04 Jul 2020 15:30:55 -0700 (PDT) Received: from pop-os ([2804:d59:26a4:c100:d8ad:591f:cc03:16f]) by smtp.gmail.com with ESMTPSA id e129sm14651808qkf.132.2020.07.04.15.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 15:30:55 -0700 (PDT) Date: Sat, 04 Jul 2020 17:30:29 -0500 From: Westerbly Snaydley Subject: Re: unexpected behavior with arrays? To: Shawn Walker Cc: ~duangle/scopes@lists.sr.ht Message-Id: In-Reply-To: References: <71NYCQ.87F07ED5PFH2@gmail.com> X-Mailer: geary/3.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed On Sat, Jul 4, 2020 at 14:28, Shawn Walker wrote: > So if I'm guessing correctly, the borrow checker you're referring to > is the "view propagation" mechanism? However, that can't be used with > the lower-level constructs and some of the APIs? Correct. Non-unique ("plain") types - the case for most (all?) of the low level parts - aren't checked and constructs like `drop` or `view` are ignored when used on them. > I was trying to puzzle out the subtleties between let, local, etc. > using examples from the tests. The documentation and test examples > made it clear enough that local was stack, global was heap, etc. but > let is still murky to me. My understanding is that let is generally > register-based allocation for values unless you use something like > alloca-x but maybe it's stack too? globals are the equivalent to data section variables in an AOT program. Conceptually they are not the same as something you allocate using `malloc`; their lifespan is the same as your program's. `let` binds a value to a name. Generally it's used to bind the immutable result of an expression, in which case it will be stored in a virtual register (might be promoted to stack if necessary, but you still can't change it). You can also bind a local/global variable to an alias, or even types and other compile-time only objects. This incurs no transformation, the only difference is the name by which you call them. Westerbly (radgeRayden) Snaydley.