For the modern D developer, which is the more preferred choice, to use 'is' or '=='?
Do the Style Guidelines or other authorities prefer one to the other for modern D coding?
Or is either equally satisfactory?
Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 30 is vs == | ||||
---|---|---|---|---|
| ||||
For the modern D developer, which is the more preferred choice, to use 'is' or '=='? Do the Style Guidelines or other authorities prefer one to the other for modern D coding? Or is either equally satisfactory? |
August 31 Re: is vs == | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brother Bill | On Saturday, 30 August 2025 at 22:15:26 UTC, Brother Bill wrote: >For the modern D developer, which is the more preferred choice, to use 'is' or '=='? Do the Style Guidelines or other authorities prefer one to the other for modern D coding? Or is either equally satisfactory? different things |
August 31 Re: is vs == | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brother Bill | On Saturday, 30 August 2025 at 22:15:26 UTC, Brother Bill wrote: >For the modern D developer, which is the more preferred choice, to use 'is' or '=='?
Do the Style Guidelines or other authorities prefer one to the other for modern D coding? Or is either equally satisfactory? For value types that do not hook logical equality,
-Steve |
August 31 Re: is vs == | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brother Bill | On Saturday, 30 August 2025 at 22:15:26 UTC, Brother Bill wrote: >Do the Style Guidelines or other authorities prefer one to the other for modern D coding? No: https://dlang.org/dstyle.html >For the modern D developer, which is the more preferred choice, to use 'is' or '=='? This question doesn't make much sense. It's like if you asked the same thing about delegates vs functions. |
August 31 Re: is vs == | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brother Bill | On Sat, Aug 30, 2025 at 10:15:26PM +0000, Brother Bill via Digitalmars-d-learn wrote: > For the modern D developer, which is the more preferred choice, to use 'is' or '=='? [...] They have two different meanings. `is` is for determining identity (is this the same variable); whereas `==` is for comparing values (do these two variables have the same value). They are not interchangeable. T -- There are 10 kinds of people in the world: those who can count in binary, and those who can't. |