www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Questions about dmd source

reply Francis Nixon <13nixonf gmail.com> writes:
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?
Jul 29
next sibling parent Anton Fediushin <fediushin.anton yandex.ru> writes:
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.
Jul 29
prev sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
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.
Jul 29