On 2011-09-28 19:14, Jonathan M Davis wrote:
On Wednesday, September 28, 2011 07:45 Gor Gyolchanyan wrote:
I agree, that rewriting the language is not a good idea until the
current version is fully studied, so i don't want D3 either. D2 is
good enough for now.
But I don't have D2 because most of what makes it unique isn't
implemented or is buggy. And i still won't have it for a long long
time (I really want classes in CTFE, for example).
Having a D compiler for D would be cool, but really, does it matter? At least,
to the average programmer? The average programmer wants a compiler that works.
Fixing dmd's bugs gets you that. That's what's being done. Rewriting dmd in D
doesn't help with that at all. In fact it makes it worse, because it's
inevitable that new bugs will be introduced.
In the long run, it would be nice to have a compiler in D (maybe even the
primary compiler), and maybe such a compiler could be more performant thanks
to slicing and the like. But until D2 is fully stable, that just seems like
wasted effort. There are far more important things for getting D2 fully
usable. The operative word is "nice." It would be _nice_ if we had a fully
working D compiler in D, but it's far from necessary and really doesn't gain
us much at this point in time.
I honestly don't understand why having a D compiler in written in D is so
important to some people. What we need is a solid compiler. The language that
it's in doesn't matter all that much IMHO. Yes, it's a good sign for D if it
can have a fully functional, performant compiler written in D (especially if
it's _more_ performant than a comparable compiler written in C++), but what
matters is being able to write your own code in D, not whether the tools
you're using were written in any particular language.
However, regardless of why you might want another D compiler with a new
frontend, I think that it would make a _lot_ of sense to wait until D2's spec
has completely stabilized (it's fairly stable now but not completely stable),
and dmd is more or less bug-free (obviously not completely bug-free, but on
the level typically expected of a compiler). That would severely reduce how
much rewriting you would have to do as D and dmd change, and the problem would
become much more tractable.
- Jonathan M Davis
Yes it does matter. The most important thing isn't what language the
compiler is written in, but let me but it this way. There are some much
else, beside from a compiler, that a frontend can be used for:
IDE integration:
* Syntax highlighting
* Code completion
* Showing syntax and semantic errors
* Refactoring
* Outline views
* DDoc views
Other:
* Debugger
* Source-to-source compiler
Example of how it's working with GCC (or has been working). There's a
complete frontend in the compiler. There's another half-working
frontend/expression parser in the debugger. There's third half-working
frontend in some IDE. That's just crazy.
What is important is to have a modular frontend that can be used as a
library. Having something like what Clang is for C/C++/Objective-C, but
for D.
We all want to write our programs and tools in D, that's why we're here
right. Now, what if it happens that your tool needs some kind of
functionality that can be found in the frontend. With a modular frontend
that can be used like a library you just use the frontend as every other
library and there's nothing special about it. To be able to use the
library with D it would be a lot easier if it's written in D, not
necessary, but a lot easier.
So in the end, the language a compiler/frontend is written in is quite
important.
--
/Jacob Carlborg