On Friday, 12 April 2013 at 08:34:15 UTC, Johannes Pfau wrote:
Am Fri, 12 Apr 2013 17:04:08 +1000
schrieb Manu <[email protected]>:


I've said before, I sadly have to avoid phobos like the plague. Some modules (like this one) that provide fundamental functionality - not just helper functions - can't be avoided. Requirements for those
should be extra strict in my opinion.


Most (GC) allocations could be fixed without breaking the API. I can
see 2 places where the API forces _GC_ allocations:
* string[string]
* thrown Exceptions are allocated with the GC

There is no simple solution for these. Maybe we'll have a hashtable in the standard library at some point which will allow to use custom allocators. Then std.process could use these. Exceptions require some thinking. You can of course allocate them using any allocator, but
freeing them is difficult...

If you want to get rid of all (not only GC) allocations, there's another
issue: As D strings are not zero terminated we'll always have
allocations passing those to C code. Maybe we should have a cstring type in phobos which would just be a string which is guaranteed to be
zero terminated.

http://dpaste.dzfl.pl/e76aa995 (needs some inout though)


This is the Object Pascal way, although you can reach to a point where you get language native strings and C strings mixed all over the place.

Not to mention that C strings should not be allowed in safe code.

--
Paulo

Reply via email to