Thread overview
Questions about dmd source
Jul 30, 2017
Francis Nixon
Jul 30, 2017
Anton Fediushin
Jul 30, 2017
ketmar
July 30, 2017
I have two completely unrelated questions about the dmd source code.

1. What does the mtype.Type.dotExp method do? The documentation comment says that it "Accesses the members of the object e". I'm not sure exactly why I would want to do that? Is it for handling types specified using an identifier/template chain (aka foo.bar!(uint).c)?

2. I've noticed there are some rather long methods in the dmd source, involving more than one goto; parse.d is particularly bad. Is there a reason for this/is it being fixed?
July 30, 2017
On Sunday, 30 July 2017 at 06:18:16 UTC, Francis Nixon wrote:
> I have two completely unrelated questions about the dmd source code.

> 2. I've noticed there are some rather long methods in the dmd source, involving more than one goto; parse.d is particularly bad. Is there a reason for this/is it being fixed?

It is impossible to write short parser, and goto operators are quite useful in such code.
Also, there is no need to rewrite anything unless it is slow or buggy, and parse.d probably isn't.
July 30, 2017
Francis Nixon wrote:

> I have two completely unrelated questions about the dmd source code.
>
> 1. What does the mtype.Type.dotExp method do? The documentation comment says that it "Accesses the members of the object e". I'm not sure exactly why I would want to do that? Is it for handling types specified using an identifier/template chain (aka foo.bar!(uint).c)?
types has some built-in properties, like `.length`, `.sizeof`, `.init` and so on. this method is used to access those properties.


> 2. I've noticed there are some rather long methods in the dmd source, involving more than one goto; parse.d is particularly bad. Is there a reason for this/is it being fixed?
it just was done this way. dmd parser was "evolved", so what you see is a result of evolution (it is not stopeed yet ;-), and evolution doesn't produce ideal results. there is no need to specifically "fix" working things, it doesn't do any good.