float init 0 request
Mindy Batek (0xEAB)
desisma at heidel.beer
Fri Aug 21 20:54:25 UTC 2026
On Friday, 14 August 2026 at 17:26:04 UTC, Walter Bright wrote:
> It's a small point, but D is an elegant language, and requiring
> people to write smelly code is not elegant.
I suppose that should make us rethink transitive `const`, too.
Currently, there’s a hole in D’s expressiveness with regard to
*mutable* variables holding values of `const` types.
```d
int foo() const
{
for (auto next = this.next; next !is null; next = next.next) //
Error: cannot modify `const` expression `next`
{
// […]
```
… has to be rewritten to the not-so-elegant …
```d
int foo() const
{
for (auto next = (() @trusted => cast() this.next)(); next !is
null; next = next.next)
{
// […]
```
More information about the Digitalmars-d
mailing list