Bug 23504 – Allow `with` with multiple arguments

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-11-23T10:37:48Z
Last change time
2024-12-13T19:25:52Z
Assigned to
No Owner
Creator
Bolpat
Moved to GitHub: dmd#20191 →

Comments

Comment #0 by qs.il.paperinik — 2022-11-23T10:37:48Z
Currently, `with` can only have one type or expression argument. When multiple resolvers are needed, one has to nest the `with` statements. Among the semantics is that one has priority over the other. If that is not intended, there’s no way to get around it. Proposed: `with (A, B, C)`. When an identifier `id` is encountered and among `A.id`, `B.id`, and `C.id` more than one resolve, it is an ambiguity error. It expresses the intent of the programmer that either ambiguity is expected to be impossible or that ambiguity is might be impossible, but the code should explicitly disambiguate to avoid confusion on the side of the reader. When members are added or renamed in `A`, `B`, or `C`, this construct is resistant to silent change of behavior. When `Ts` is a compile-time sequence (AliasSeq), `with (Ts)` does not compile, even if the sequence has exactly 1 element. Proposed: When `Ts` is a compile-time sequence (AliasSeq), `with (A, Ts, C)` is as if `with (A, Ts[0], ..., Ts[$-1], C)`, i.e. `Ts` will be expanded as one would expect.
Comment #1 by robert.schadek — 2024-12-13T19:25:52Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20191 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB