[Issue 11284] add -allinst compiler switch

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 18 17:44:18 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11284



--- Comment #6 from Dicebot <public at dicebot.lv> 2013-10-18 17:44:14 PDT ---
(In reply to comment #5)
> One way to improve the situation a little that I think doesn't require compiler
> changes is to add a "private":
> 
> private int foo(int x) { return x ^^ 2; }
> 
> If this "foo" is used only at compile-time inside the module, then perhaps it
> should not appear in the module object.

Unfortunately, it is not that simple.

First, it may break existing code as currently it has external linkage and can
be used from C modules. Second, some private symbols may actually leak outside
of the module via public aliases and function parameters / return values. This
is partially explained here:

http://wiki.dlang.org/Access_specifiers_and_visibility
http://wiki.dlang.org/DIP22.1

What is more important, though, is that templates and CTFE functions are rarely
used in the same module they are declared. I have several ideas for more
efficient design that can fix this but all contain breaking changes when it
comes to separate compilation (in absence of whole program optimization at
least).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list