What is the correct way to unify the types of two operands of a binary operator? The specs talk here and there a little bit about rules for implicit conversions, but that doesn't really tell me much about how to implement this stuff in my own compiler.
I'd love to have a detailed guide for how to actually do semantic analysis in a D compiler. There really need to be documents that explain the D language with actual compiler writers in mind. I have seen such a thing for Java some time ago on the web. I would've given a link, but I don't remember anymore where I saw it.
Perhaps somebody, who knows the front-end well, could help you out on typing up these kind of documents? A sort of collaborative project using a wiki system?
Most of the time I simply have no clue what to do, SA is darn complex. :(
Comment #1 by shro8822 — 2008-12-17T19:19:52Z
could you give an example of what you want?
If you want "What is the type of `int + long`?" take a look at typeof().
If that is what you are looking for, where would you expect to see that info?
Comment #2 by dfj1esp02 — 2008-12-18T03:56:41Z
I think, arithmetic in D is the same as in C.
Comment #3 by bugzilla — 2012-01-22T21:14:05Z
It depends on which binary operator, as they have behaviors custom to what they are supposed to do. If the spec is incomplete on a particular operator, please point that out. In the meantime, this bug report is a bit too vague to be actionable.