string, char[], overloaded functions.
via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Nov 1 01:36:40 PDT 2014
On Saturday, 1 November 2014 at 03:28:36 UTC, ketmar via
Digitalmars-d-learn wrote:
> On Sat, 01 Nov 2014 00:05:19 +0000
> "Adam D. Ruppe via Digitalmars-d-learn"
> <digitalmars-d-learn at puremagic.com> wrote:
>
>> BTW one could argue that char[] ~ operator should yield
>> something that's implicitly convertable, since it allocates a
>> new memory block anyway, but that's not how it works right now.
> it's not necessarily allocates. but `(buf~"hoo").idup` does, so
> it can
> be used. ;-)
No, it's `~=` that may or may not allocate, but `~` always does.
I think it's an instance of this bug [1]; `buf~"hoo"` should be
inferred as unique, and therefore convert to `immutable`.
https://issues.dlang.org/show_bug.cgi?id=1654
More information about the Digitalmars-d-learn
mailing list