On Tuesday, 1 March 2016 at 13:48:18 UTC, Andrei Alexandrescu wrote:
On 02/28/2016 11:57 PM, Walter Bright wrote:
There are good reasons for that. But there's no reason why
std.algorithm.sort, for example, cannot still be used (cut & paste).

How would cutting and pasting from phobos be better than using it? -- Andrei

You avoid a circular dependency. If it's just stuff like the functions in std.algorithm, it's probably not too bad, but if anything pulls in std.conv, std.format, std.stdio, etc., you end up with a bunch of extra stuff, whereas what the compiler really needs is probably only a small piece of that. And if there's a bug in any of the Phobos code that the compiler uses, you end up with a bug in the compiler, which in turn causes bugs when compiling Phobos...

Copying specific pieces of Phobos and pasting them into dmd does allow for stuff that's more specific to what dmd is doing and avoids dependency issues - but it does mean copying, which means code duplication and can cause it's own set of problems.

I don't know if it's ultimately better to have dmd use Phobos or not, but it does avoid some potentially weird dependency issues with bugs if we avoid it. Things already get weird enough when Phobos depends on itself. Locking the version down like Ola Fosheim Grøstad is talking about definitely would mitigate the problem, but it would just be simpler to avoid it. Regardless, I'll leave it up to the compiler devs to come to a decision on that one.

- Jonathan M Davis

Reply via email to