<div dir="ltr">On 12 April 2013 18:34, Johannes Pfau <span dir="ltr"><<a href="mailto:nospam@example.com" target="_blank">nospam@example.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Am Fri, 12 Apr 2013 17:04:08 +1000<br>
schrieb Manu <<a href="mailto:turkeyman@gmail.com">turkeyman@gmail.com</a>>:<br>
<div class="im"><br>
><br>
> I've said before, I sadly have to avoid phobos like the plague. Some<br>
> modules (like this one) that provide fundamental functionality - not<br>
> just helper functions - can't be avoided. Requirements for those<br>
> should be extra strict in my opinion.<br>
><br>
<br>
</div>Most (GC) allocations could be fixed without breaking the API. I can<br>
see 2 places where the API forces _GC_ allocations:<br>
* string[string]<br>
* thrown Exceptions are allocated with the GC<br>
<br>
There is no simple solution for these. Maybe we'll have a hashtable in<br>
the standard library at some point which will allow to use custom<br>
allocators. Then std.process could use these. Exceptions require some<br>
thinking. You can of course allocate them using any allocator, but<br>
freeing them is difficult...<br></blockquote><div><br></div><div style>Exceptions are exceptional, I don't think that's an issue.</div><div style>the string[string] in the api is guaranteed garbage, and will never be changed. What's the advantage of using an AA in this case?</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If you want to get rid of all (not only GC) allocations, there's another<br>
issue: As D strings are not zero terminated we'll always have<br>
allocations passing those to C code.</blockquote><div><br></div><div style>They are being passed through to a C function that doesn't retain the pointer; they can be allocated on the stack.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 Maybe we should have a cstring<br>
type in phobos which would just be a string which is guaranteed to be<br>
zero terminated.<br></blockquote><div><br></div><div style>Maybe, although the point here is to wrap up and hide the C API, so that's not useful here. A helper in phobos for allocating a (c)string on the stack may be useful...</div>
</div></div></div>