November 24, 2022 [Issue 23505] New: `with` cannot be used with built-in types | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23505 Issue ID: 23505 Summary: `with` cannot be used with built-in types Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: qs.il.paperinik@gmail.com `with (int) { }` does not parse and `alias Int = int; with (Int) { }` does not compile, saying that "`with` type `int` has no members". This is nonsense in two ways: 1. Even if `int` has no members, I should be able to write this. Generic code might do that. 2. And `int` does at least appear to have members: `min`, `max`, `init` are some obvious ones. For `double`, there are even more interesting members, like `nan`, `infinity`, and `epsilon`. See https://dlang.org/spec/property.html -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply