[Issue 23505] New: `with` cannot be used with built-in types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 24 10:05:22 UTC 2022


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 at puremagic.com
          Reporter: qs.il.paperinik at 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

--


More information about the Digitalmars-d-bugs mailing list