[Issue 13084] ModuleInfo.opApply delegate expects immutable parameter

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 18 00:47:30 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13084

--- Comment #25 from Walter Bright <bugzilla at digitalmars.com> ---
Let's list a few objective facts:

1. The current situation (this bug report) occurs in the wild in real code in
more than one project. Existing code is broken.

2. https://issues.dlang.org/show_bug.cgi?id=13148 has not been shown to occur
anywhere in existing code, it is conjecture. A reason to write such code has
not been demonstrated.

3. If there is a reason to write 13148 code, it can be fixed with the
Unqual!ModuleInfo change.

4. In either solution, using ModuleInfo incorrectly will result in compiler
errors, not silent corruption.


Therefore it seems highly likely that there will be far more instances of
requiring users to write immutable(ModuleInfo) than Unqual!ModuleInfo. Making
ModuleInfo an immutable alias thus breaks far less existing code.

(Inferring that an unadorned type name would necessarily be mutable comes as a
surprise to me. This assumption is not stated anywhere in the documentation nor
in common usage. A grep of phobos/std shows immutable aliases occurring. It's
one of the things alias is for.)

--


More information about the Digitalmars-d-bugs mailing list