I know I'm coming into this a bit late, but in general I only feel like there's a problem with built-in dynamic types. It generally isn't hard to manage the lifetime of classes manually, and I don't tend to churn through them. Also, there are basically no routines in Phobos that operate on classes, so that's really entirely my problem as a user anyway. What concerns me most is string processing, and in particular the routines in Phobos that do string processing. And while I've always liked the idea of supplying a destination buffer to these routines, it doesn't help the case where the buffer is too small and allocation still needs to occur.

Instead of sorting out some crazy return type or supplying a raw destination buffer, what if we instead supply an appender? Then the appender could grow the buffer in place or throw or whatever we want the behavior to be when out of space. I think this would solve 90% of my concerns about unexpected GC pauses in my code. For the rest, any temporary allocations inside Phobos routines should either be eliminated, reused on each call per a static reference, or cleaned up. I'm really okay with the occasional "new" inside a routine so long as repeated calls to that routine don't generate tons of garbage and thus trigger a collection.

Reply via email to