Creeping Bloat in Phobos

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 28 16:42:17 PDT 2014


On 9/28/2014 1:33 PM, Andrei Alexandrescu wrote:
> On 9/28/14, 11:36 AM, Walter Bright wrote:
>> Currently, the autodecoding functions allocate with the GC and throw as
>> well. (They'll GC allocate an exception and throw it if they encounter
>> an invalid UTF sequence. The adapters use the more common method of
>> inserting a substitution character and continuing on.) This makes it
>> harder to make GC-free Phobos code.
>
> The right solution here is refcounted exception plus policy-based functions in
> conjunction with RCString. I can't believe this focus has already been lost and
> we're back to let's remove autodecoding and ban exceptions. -- Andrei

Or setExt() can simply insert .byCodeUnit as I suggested in the PR, and it's 
done and working correctly and doesn't throw and doesn't allocate and goes fast.

Not everything in Phobos can be dealt with so easily, of course, but there's 
quite a bit of low hanging fruit of this nature we can just take care of now.


More information about the Digitalmars-d mailing list