On 2010-12-19 19:29, Michel Fortin wrote:
On 2010-12-19 11:11:03 -0500, Jacob Carlborg <d...@me.com> said:
On 2010-12-19 16:23, Andrei Alexandrescu wrote:
On 12/19/10 6:26 AM, retard wrote:
In case you didn't see, two additional problems were also listed
earlier
in this thread:
- template bloat (different strings generate new instances of the sort
in the sorting example)
This can be solved by using a canonicalizer before passing to unaryFun.
I considered doing that, but delayed implementing it to when this would
actually become a problem.
I can clearly see that you haven't used an Objective-C/D bridge. The
reason (or at least one of the reasons) for which Michel Fortin (as
well as I) gave up the Objective-C/D bridge and started to modify DMD
is template bloat. I'm not saying that using template strings as
lambdas is going to bloat your executable/library as much as the
bridge does but I always think twice before adding a template to my code.
Has anyone checked which of delegates or strings cause more template bloat?
I'd suspect using strings will result in less bloat because the same
string will often be reused (making the compiler reuse the same template
instance) whereas the compiler will likely use the mangled name of the
delegate when instantiating the template... and no two delegate literals
have the same mangled name.
That would only be the case if the function takes the delegate as a
template parameter?
--
/Jacob Carlborg