toString refactor in druntime
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Nov 3 17:09:24 PST 2014
On 11/3/2014 2:28 PM, Steven Schveighoffer wrote:
> I had a very nasty experience with using a template-based API. I vowed to avoid
> it wherever possible.
>
> The culprit was std::string -- it changed something internally from one version
> of libc++ to the next on Linux. So I had to recompile everything, but the whole
> system I was using was with .so objects.
>
> templates do NOT make good API types IMO.
It seems this is blaming templates for a different problem.
If I have:
struct S { int x; };
in my C .h file, and I change it to:
struct S { int x,y; };
Then all my API functions that take S as a value argument will require
recompilation of any code that uses it.
Would you conclude that C sux for making APIs? Of course not. You'd say that a
stable API should use reference types, not value types.
Having templates or not is irrelevant.
More information about the Digitalmars-d
mailing list