Syntax: how to return shared?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 7 10:21:04 PDT 2015


On Friday, 7 August 2015 at 17:19:16 UTC, Marek Janukowicz wrote:
> shared (shared Foo) foo () {
>   ...
> }

That's correct, though the recommendation now is to put the other 
shared on teh right and change the parens a little:

shared(Foo) foo() shared {

}

The ones without parens refer to the `this` in there and are 
kinda confusing to see on the left, so putting them on the right 
looks a bit easier (same with const btw).


More information about the Digitalmars-d-learn mailing list