Rational of some DMD decisions

Robin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 8 13:05:56 PST 2015


Hiho,

as I am currently very insterested in compiler implementation I 
often look into the DMD github and look how things are done 
there. Often I find myself curious about things at first but find 
out the rational behind certain implementation decisions.

One thing I can't figure out is the different approach with pre- 
and postfix expressions. While prefix expressions inherit from 
UnaExp (unary expression) which makes sense to me as it is an 
expression with only one parameter (in general) the postfix inc 
and decrement expressions are inherited from BinExpr (binary 
expression) which define their second expression to be an integer 
expression with a value of 1.

So I am very curious about the rational behind this design 
decision. Why do Postfix expression not inherit from UnaExp, too? 
Am I missing something very important?

Thanks in advance! =)

I hope this is the right place to ask questions about the DMD 
compiler.

Regards,
Robin


More information about the Digitalmars-d-learn mailing list