September 03, 2021 Issues » [Issue 22270] [DIP1000] class does infer scope in methods when assigned to a scope variable | |||
|---|---|---|---|
| |||
...dip1000:
```
struct Bar
{
int[] arr;
@safe Wrapper dummy() {
Wrapper wrapper = { bar: &this };
return wrapper;
}
}
struct... | |||
September 03, 2021 Issues » [Issue 22270] [DIP1000] class does infer scope in methods when assigned to a scope variable | |||
|---|---|---|---|
| |||
...access, and mark dummy @trusted:
```
struct Bar
{
int[] somePointerToRestrictThis;
@trusted Wrapper dummy() return scope {
Wrapper... | |||
September 03, 2021 Issues » [Issue 22270] [DIP1000] class does infer scope in methods when assigned to a scope variable | |||
|---|---|---|---|
| |||
...code?
---
struct Bar
{
int[] somePointerToRestrictThis;
@safe Wrapper dummy() return scope {
Wrapper wrapper = { bar: &this };
return... | |||
September 03, 2021 Issues » [Issue 22270] [DIP1000] class does infer scope in methods when assigned to a scope variable | |||
|---|---|---|---|
| |||
...x;
@safe void dummy() {}
}
@safe
void main()
{
scope bar = Bar();
bar.dummy; // ok
}
```
onlineapp.d... | |||
September 03, 2021 Issues » [Issue 22270] [DIP1000] class does infer scope in methods when assigned to a scope variable | |||
|---|---|---|---|
| |||
...DIP1000
---
struct Bar
{
@safe void dummy() {}
}
@safe
void main()
{
scope bar = Bar();
bar.dummy; // ok
}
---
-- | |||
September 03, 2021 Issues » [Issue 22270] [DIP1000] class does infer scope in methods when assigned to a scope variable | |||
|---|---|---|---|
| |||
...bar = new Bar;
(*bar).dummy; // dereference strips away the scope layer
}
```
`dummy` can't escape... | |||
September 03, 2021 Issues » [Issue 22270] New: [DIP1000] class does infer scope in methods when assigned to a scope variable | |||
|---|---|---|---|
| |||
...dummy() {}
}
class Foo
{
@safe void dummy() {}
}
@safe
void main()
{
scope bar = new Bar;
bar.dummy... | |||
August 30, 2021 Learn » Re: Labelled @nogc Working With Inner Scopes | |||
|---|---|---|---|
| |||
...keyword is optional in that place:
struct Dummy
{
// ...
this(int memberInt, string memberStr) nothrow
in... | |||
August 30, 2021 Learn » Labelled @nogc Working With Inner Scopes | |||
|---|---|---|---|
| |||
...dummy;
/// Test [cg.math.dummy.dummy.Dummy.doStuff()]
unittest
{
Dummy instance = Dummy(4, "A dummy... | |||
August 17, 2021 Learn » How to get element type of a slice? | |||
|---|---|---|---|
| |||
...static if (isArray!VecPoint){
VecPoint dummy;
alias Point = typeof(dummy[0]);
} else static if (isRandomAccessRange... | |||
Copyright © 1999-2021 by the D Language Foundation