On 6/23/22 8:01 AM, Dukc wrote:
On Thursday, 23 June 2022 at 00:37:24 UTC, Steven Schveighoffer wrote:
You mean like a system function which removes the scope-ness of an
array? Let me introduce you to my other thread:
https://forum.dlang.org/thread/[email protected]
You are allowed to remove `scope` from an argument in unsafe code. It's
only if you escape that argument when you trigger undefined behaviour.
Just like you can cast away `const`, if you don't actually mutate the
cast variable.
And what do you think a custom struct that circumvents the scopeness is
going to do with that parameter?
To be clear, I think we're talking about something like:
```d
struct ScopeArray(T)
{
T[] arr;
@system void opAssign(scope T[] param)
{
arr = param; // escaping scope
}
}
```
-Steve