On Thu, Sep 11, 2008 at 2:44 PM, Chris Prince <[EMAIL PROTECTED]> wrote:
> For example, most methods that today take a String could instead > accept a StringOrBlob. Both objects represent a chunk of immutable > data; it just happens to be text- or binary-based data. > > Instead of 'StringBuilder' or 'ArrayBuilder' classes, there are > methods like concat(). Couldn't we add Blob.concat(), and let it > accept a String or Blob? But a concat() method would be completely throwing away Blob immutability. Is that a change that we are willing to make? As for the performance implications of a blob.concat() method, it probably wouldn't be too bad. We could replace the GearsBlob's contents with a JoinBlob constructed from the original contents and the contents of the argument. The JoinBlob constructor calls length() on each blob during construction, but if this becomes too much of a performance penalty, we could change the implementation and defer that calculation until it is needed. -- Brad
