On Mon, 2008-09-08 at 15:49 +0200, Kinkie wrote:

> But I'd leave the operator =
> 
> KBuf foo="bar";
> is quite convenient IMO.

It sure is, and I have no objections at this point.

In many cases, the assignment would look like

  String foo = some expression returning char*;

though and the developer will miss cases where a String is converted to
char* and then converted back to [a new] String. In other words, the
char* assignment operator helps to miss escapes from the carefully
designed String and Buffer "garden" even if it only provides a backdoor
into that garden.

Since statements like the example above should be rarely executed (for
performance reasons), I think making them inconvenient may be a good
thing:

  String foo = String::Allocate("bar"); // XXX: expensive!
or
  String foo = String::Create("bar"); // TODO: make a static const

Cheers,

Alex.


Reply via email to