On 5/22/16 5:42 PM, Andrei Alexandrescu wrote:
On 05/21/2016 03:13 PM, Kagamin wrote:
On Saturday, 21 May 2016 at 18:18:21 UTC, Andrei Alexandrescu wrote:
He said that that won't happen any longer, the growth was because of
the return type. Is that correct?
https://issues.dlang.org/show_bug.cgi?id=15831#c4
Looks like growth is due to the fact that the voldemort type is in the
scope of a function and function is fun!(T).fun(T) - hence each level
multiplies by 2. And return type is not part of the mangled name already
- that would cause circular dependency, you would need the voldemort
type mangling to generate it.
Just to make sure I understand: do you agree or disagree that there's no
more exponential growth if we encode "auto return" in the mangling? Thx!
-- Andrei
Not sure if someone has definitively answered before, but no, this does
not. I think this would shrink the growth from 3^n to 2^n.
The exponential growth happens because of the repeating of the template
types.
If you look at the example in the bug report, there is no return types
anywhere. They exist in the mangled names, but are not relevant to the
FQN or symbol resolution. The return type only plays a factor for
preventing linking against other files that expect a certain return
type. In fact, this may be a reason to NOT shortcut the return mangle
(if you had compiled against foo one day, and foo's internal voldemort
type changes the next, it would still link, even though the type may
have changed).
Indeed, D does not overload based on return type ever.
-Steve