new DIP47: Outlining member functions of aggregates
Dmitry Olshansky
dmitry.olsh at gmail.com
Sat Sep 7 11:01:53 PDT 2013
07-Sep-2013 21:00, Walter Bright пишет:
> Outlining of member functions is the practice of placing the declaration
> of a member function in the struct/class/union, and placing the
> definition of it at global scope in the module or even in another module.
>
> http://wiki.dlang.org/DIP47
7. Outlined member function return types, parameter types, and function
bodies have private access to the module where the aggregate is declared.
I understand why you may want this hack but it starts to smells real
bad. Not only we haven't fixed bugs in our module system yet we
introduce another kludge into it to support the C++ header + unknown set
of files with implementations. Another twist in visibility/accessiblity
lookup rules. I expect another wave of bugs regarding @safe/pure/etc.
silently accepted for outlined functions and so on.
Now you can't know if a module implements all of stuff it declares or
not. Or where it is implemented at all. I would rather restrict this
feature w.r.t. where outlined methods can be defined - e.g. same module
or in the same sub-package.
Accessibility rules should stay the same as they are now. In that
setting if one wants to split methods across multiple file - fine, just
declare them 'package' and put implementations deeper down the package
tree.
TL;DR: DROP point 7, and describe how to use 'package' to split
implementation across multiple files.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list