Making sense out of scope and function calls

0xEAB desisma at heidel.beer
Sun Nov 13 20:03:10 UTC 2022


On Sunday, 13 November 2022 at 19:36:48 UTC, Dennis wrote:
> Can you please provide a full example? I'm missing the 
> definitions of _headers, hstring, values

```d
/++
     “HTTP message string” – short-hand for `const(char)[]``.

     $(SIDEBAR
         Not sure about the name.
         Would have prefered *cstring* (*const string* as opposed 
to D’s default immutable one),
         but the common association with that term would be 
“zero-terminated string (as made famous by C)”.
     )
  +/
alias hstring = const(char)[];

struct Foo {
     private Headers _headers;
```

`Headers` was basically like the one here[0], just annoted with 
`scope` `scope return` etc. all over the place. I’m sorry, I 
don’t have any copy of that around anymore (as I’ve never 
commited it and already discarded my code + the idea of using 
`scope` – in its current state – in real world code).

> and I suspect there's at least one `@safe` annotation somewhere.

yeah, everything is `@safe` here.


[0] 
https://github.com/oceandrift/http/blob/982030123bdbfb64681264d42ade15d0ccc9ebe9/message/oceandrift/http/message.d#L264



More information about the Digitalmars-d-learn mailing list