Yadier Molina joins Cardinals entrance workplace

2024-07-25 Thread vitreous via Digitalmars-d-learn
NASHVILLE, Tenn. Yadier Molina, a franchise fixture at catcher for 19 seasons and the powering tension powering Planet Sequence wins inside 2006 and 11, rejoined the Cardinals as a exceptional assistant toward president of baseball functions John Mozeliak, the club declared upon 41 yr outda

5/18 Gamethread: Giants vs. Rockies

2024-07-25 Thread vitreous via Digitalmars-d-learn
Luis Matos strike a 3 operate dwelling function as I was positioning this thread collectively hence, youre welcome. Only overall look at it pay attention in direction of it soak it up and saLUte RFZoKVfgyJ SFGiants May perhaps 18, 2024Its a wonder what a 3 function property function can do. I

Re: What is an rvalue constructor?

2024-07-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 25, 2024 4:48:06 PM MDT Quirin Schroll via Digitalmars-d- learn wrote: > It seems one can’t have one in a struct together with a copy > constructor, but what is it? When is it called? What is it for? An rvalue constructor is a constructor that takes the same type as the struct th

Re: Prevent self-comparison without taking the address

2024-07-25 Thread Jonathan M Davis via Digitalmars-d-learn
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(&x==&this) ret

Re: copy must be const?!?

2024-07-25 Thread Quirin Schroll via Digitalmars-d-learn
On Thursday, 25 July 2024 at 13:07:03 UTC, Jonathan M Davis wrote: On Thursday, July 25, 2024 6:00:58 AM MDT Dom DiSc via Digitalmars-d-learn wrote: > And no, in general, you don't want to be casting away const > or immutable. There are cases where it can work (e.g. if the > cast does a copy, w

Re: Prevent self-comparison without taking the address

2024-07-25 Thread Nick Treleaven via Digitalmars-d-learn
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

Re: Prevent self-comparison without taking the address

2024-07-25 Thread IchorDev via Digitalmars-d-learn
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 anyth

Re: Prevent self-comparison without taking the address

2024-07-25 Thread Dom DiSc via Digitalmars-d-learn
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 `AttributeSpecifi

Re: Prevent self-comparison without taking the address

2024-07-25 Thread IchorDev via Digitalmars-d-learn
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?

Re: copy must be const?!?

2024-07-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 25, 2024 6:00:58 AM MDT Dom DiSc via Digitalmars-d-learn wrote: > > And no, in general, you don't want to be casting away const or > > immutable. There are cases where it can work (e.g. if the cast > > does a copy, which it would with an integer type) > > But a parameter given by

Re: Prevent self-comparison without taking the address

2024-07-25 Thread Dennis via Digitalmars-d-learn
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

Re: copy must be const?!?

2024-07-25 Thread Dom DiSc via Digitalmars-d-learn
On Thursday, 25 July 2024 at 08:42:29 UTC, Jonathan M Davis wrote: It's not a cast. Casts in D use the keyword, cast - e.g. return --(cast(T)x); Rather, Dennis' solution is constructing a value of the given type. For it to work, T must be constructible from an immutable T - which works wi

Re: Prevent self-comparison without taking the address

2024-07-25 Thread IchorDev via Digitalmars-d-learn
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.

Re: Prevent self-comparison without taking the address

2024-07-25 Thread IchorDev via Digitalmars-d-learn
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 a

Prevent self-comparison without taking the address

2024-07-25 Thread Dom DiSc via Digitalmars-d-learn
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(&x==&this) return true; ... } } ``` Can I replace this pattern with ```(x is this)``` or are there some sp

Re: copy must be const?!?

2024-07-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 25, 2024 12:50:04 AM MDT Dom DiSc via Digitalmars-d-learn wrote: > On Wednesday, 24 July 2024 at 15:40:28 UTC, Dennis wrote: > >> Is there a way to tell the compiler that it should discard > >> "const" and "immutable" if it needs to create a copy? > >> Unqual!T doesn't work :-( >