On Borrow Checking

Manu turkeyman at gmail.com
Fri May 16 01:31:16 UTC 2025


On Tue, 13 May 2025 at 04:51, Walter Bright via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On 5/12/2025 4:16 AM, Manu wrote:
> > `scope` has nothing to do with @safe, and it MUST work in its own right,
> > otherwise the code is lying to the author, and it's an effective
> liability.
>
> An escape hatch is always needed.


Well the primary escape hatch is, obviously, just don't write `scope` if
it's not scope!
But I think you could divine an alternative escape hatch if required; like
`cast(ref T)myScopeT` or something. Or alternatively just `cast(T)myScopeT`
which might normally imply that a copy is made, but the language could
detect the identity cast and elide the copy...


> For example, you might want to interface with a 3rd party library that is
> scope-correct, but is not annotated with `scope`.
>

Okay sure; find another solution. This one is insane. I suggest some form
of cast().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20250516/f6108db9/attachment.htm>


More information about the Digitalmars-d mailing list