On Thursday, 25 July 2024 at 15:40:29 UTC, Nick Treleaven wrote:
On Thursday, 25 July 2024 at 15:06:35 UTC, IchorDev wrote:
I think your function most likely has a safe interface, so it
can be marked as `@trusted` as-per [the
spec](https://dlang.org/spec/function.html#safe-interfaces).
Just
On Thursday, July 25, 2024 4:50:04 AM MDT Dom DiSc via Digitalmars-d-learn
wrote:
> I have copied some source from C++, where the following pattern
> is common (operator== already renamed):
>
> ```d
> @safe:
> struct S
> {
> bool opEquals(const ref S x) const
> {
>if(==) return
On Thursday, 25 July 2024 at 15:06:35 UTC, IchorDev wrote:
I think your function most likely has a safe interface, so it
can be marked as `@trusted` as-per [the
spec](https://dlang.org/spec/function.html#safe-interfaces).
Just to mention that with -dip1000, taking the address of
variables is
On Thursday, 25 July 2024 at 14:05:50 UTC, Dom DiSc wrote:
As he said: no. It's only true for @safe:
No they did not, they specifically said that my assertion holds
true for all other [function
attributes](https://dlang.org/spec/attribute.html#function-attributes). This does not tell me
On Thursday, 25 July 2024 at 13:20:59 UTC, IchorDev wrote:
On Thursday, 25 July 2024 at 13:01:53 UTC, Dennis wrote:
That's true for the other function attributes, but `@safe:`
actually does penetrate scopes
The spec doesn’t mention this at all! Is this the case for any
other
On Thursday, 25 July 2024 at 13:01:53 UTC, Dennis wrote:
That's true for the other function attributes, but `@safe:`
actually does penetrate scopes
The spec doesn’t mention this at all! Is this the case for any
other `AttributeSpecifier` declarations?
On Thursday, 25 July 2024 at 11:46:29 UTC, IchorDev wrote:
Also just so you know, placing `@safe:` there will not affect
the contents of `S`. It has to be inside the struct declaration
to affect its contents.
That's true for the other function attributes, but `@safe:`
actually does penetrate
On Thursday, 25 July 2024 at 10:50:04 UTC, Dom DiSc wrote:
```d
@safe:
struct S{
```
Also just so you know, placing `@safe:` there will not affect the
contents of `S`. It has to be inside the struct declaration to
affect its contents.
On Thursday, 25 July 2024 at 10:50:04 UTC, Dom DiSc wrote:
Can I replace this pattern with ```(x is this)``` or are there
some special cases where this doen't work?
When a parameter is `ref` it is treated as a value type (i.e. it
has value semantics), even though it is a reference; therefore
I have copied some source from C++, where the following pattern
is common (operator== already renamed):
```d
@safe:
struct S
{
bool opEquals(const ref S x) const
{
if(==) return true;
...
}
}
```
Can I replace this pattern with ```(x is this)``` or are there
some special
10 matches
Mail list logo