Am 09.01.2014 19:34, schrieb Walter Bright:
On 1/9/2014 10:18 AM, "Ola Fosheim Grøstad"
<ola.fosheim.grostad+dl...@gmail.com>" wrote:
On Thursday, 9 January 2014 at 17:15:46 UTC, Walter Bright wrote:
How does that work when you pass it "hello"? allocated with malloc()?
basically any data that has mixed ancestry?
Why would you do that? You would have to overload cat then.
So you agree that it won't work.
BTW, it happens all the time when dealing with strings. For example,
dealing with filenames, file extensions, and paths. Components can come
from the command line, string literals, malloc, slices, etc., all mixed
up together.
Overloading doesn't work because a string literal and a string allocated
by something else have the same type.
That doesn't work if you're passing strings with mixed ancestry.
Well, you have to decide if you want to roll your own, use a framework
or use
the old C way.
The point is more: you can make your own and make it C-compatible, and
reasonably efficient.
My point is you can't avoid making the extra copies without GC in any
reasonable way.
Every time I see such discussions, it reminds me when I started coding
in the mid-80s and the heresy of using languages like Pascal and C
dialects for microcomputers, instead of coding everything in Assembly or
Forth.
:)
--
Paulo