Shouldn't hasSwappableElements work on char arrays?
Steven Schveighoffer
schveiguy at yahoo.com
Thu Feb 24 13:45:25 PST 2011
On Thu, 24 Feb 2011 16:21:08 -0500, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> Of course it's not that hard. But when things can be safely automated,
> I don't see why they shouldn't be. Unless I'm missing some important
> factor of duping string literals that was not mentioned already.
It's a 'hidden allocation'. It leads to low performance code that looks
like it's really fast.
There are plenty of examples of hidden allocation in D already which I
would hope we could get rid of, I wouldn't want to add more.
For example, try using an AA literal as an enum, and then use that enum in
lots of places. Guess what? Each time you use it, the runtime constructs
a new instance of the AA!
I think we should strive to require explicit requests for allocations as
much as possible.
-Steve
More information about the Digitalmars-d
mailing list