Bug 23942 – deprecated public import

Status
NEW
Severity
enhancement
Priority
P5
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-05-29T14:32:41Z
Last change time
2024-12-13T19:29:17Z
Assigned to
No Owner
Creator
Vladimir Panteleev
Moved to GitHub: dmd#18170 →

Comments

Comment #0 by dlang-bugzilla — 2023-05-29T14:32:41Z
Consider a module which provides a public import, but wants to stop providing it. "deprecated public import" currently compiles, but doesn't seem to do anything. It would be nice if it caused a deprecation warning every time another module used it to use a symbol in the public-imported module. // pub.d int someSymbol; // mod.d deprecated public import pub; // user.d import mod; int fun() { return someSymbol; } // should cause a deprecation warning
Comment #1 by dlang-bugzilla — 2023-05-29T16:12:45Z
Workaround is to list all of the imported module's symbols in the public import: deprecated public import pub : someSymbol; As a bonus that locks the publicly imported symbol list, so new additions to pub won't be usable via the public import, even to users of -d.
Comment #2 by robert.schadek — 2024-12-13T19:29:17Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18170 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB