On Fri, Sep 12, 2008 at 4:55 AM, Brad Garcia <[EMAIL PROTECTED]> wrote:
> 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?

I imagined it would work exactly like String concat(), which returns a
new String object.
    var s = 'hi';
    alert(s.concat(' bob'));
    alert(s);

> 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.

Yep, exactly.  The JoinBlob concept you guys developed should make
Blob concat() quite efficient.  (Nice foresight on the "blob adapter"
classes!)

Reply via email to