Re: -preview=in deprecation warning

2023-04-20 Thread Jack Applegame via Digitalmars-d-learn

On Thursday, 20 April 2023 at 09:41:13 UTC, Dennis wrote:
On Thursday, 20 April 2023 at 09:14:48 UTC, Jack Applegame 
wrote:

Can anyone help me get rid of this depreciation?


Annotate `getFoo` with `return scope`:

```d
struct Foo {
string foo;
string getFoo() return scope const @safe { return foo; }
}


Wow. Thanks.
I tried this, but rearranged the return and scope like this
```d
// doesn't work
string getFoo() scope return const @safe { return foo; }
```
```d
// works
string getFoo() return scope const @safe { return foo; }
```



Re: -preview=in deprecation warning

2023-04-20 Thread Dennis via Digitalmars-d-learn

On Thursday, 20 April 2023 at 09:14:48 UTC, Jack Applegame wrote:

Can anyone help me get rid of this depreciation?


Annotate `getFoo` with `return scope`:

```d
struct Foo {
string foo;
string getFoo() return scope const @safe { return foo; }
}