Bug 24601 – [next edition] Make opApply result opaque

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-06-12T07:49:43Z
Last change time
2024-12-13T19:35:38Z
Keywords
safe
Assigned to
No Owner
Creator
Bolpat
Moved to GitHub: dmd#20465 →

Comments

Comment #0 by qs.il.paperinik — 2024-06-12T07:49:43Z
I take issue with the fact that `opApply` has the signature `int opApply(int delegate(…))`. The `int` part makes little sense. It would be preferable to have a type (defined in object.d) named `OpApplyResult` (which can be a wrapped `int`) and have `opApply` specified to be: `OpApplyResult opApply(OpApplyResult delegate(…))` That makes clear that the result of the delegate is to be returned.
Comment #1 by qs.il.paperinik — 2024-06-12T08:55:13Z
One reason is – and this is why I tagged this issue with safe – that it is unsafe to violate the opApply protocol.
Comment #2 by robert.schadek — 2024-12-13T19:35:38Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20465 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB