[D-runtime] Is core.math public API?

David Nadlinger code at klickverbot.at
Tue Oct 2 11:44:07 PDT 2012


On Tue, Oct 2, 2012 at 6:45 PM, Alex Rønne Petersen <xtzgzorex at gmail.com> wrote:
> It isn't.
>
> See: http://article.gmane.org/gmane.comp.lang.d.runtime/1187/match=core+math

In my opinion, saying that something isn't part of the public druntime
API, but at the same time is intended to be used from Phobos doesn't
make much sense. After all, the whole point behind druntime (well, one
of them) was to introduce a low-level abstraction layer so that Phobos
could just be a library like any other. If Phobos ends up calling
undocumented, private functions, "like any other" is definitely not
true. Why would Phobos be allowed to call core.math functions, but not
Tango or any other library?

Anyway, currently std.math does not use core.math, but declares a few
magic functions which are name-matched by DMD (the only remaining ones
in std.*, by the way). This forces us to edit that file in the LDC
copy of Phobos, because our intrinsics system works differently.

So, would anyone object if I modify std.math to forward the functions
to core.math instead, and add the latter to the public docs? Judging
from Don's message linked by Alex, this was the original intention
behind core.math anyway, and would remove one compiler dependency from
Phobos, which is imho a desirable goal. Of course, I'd also extend the
core.math docs with a short note mentioning that it only provides
low-level intrinsics and std.math is to be preferred for actual
application use.

David


More information about the D-runtime mailing list