D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2522 - Combining two types
Summary: Combining two types
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P2 major
Assignee: No Owner
URL:
Keywords: spec
Depends on:
Blocks:
 
Reported: 2008-12-17 19:14 UTC by Aziz Köksal
Modified: 2014-03-01 00:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Aziz Köksal 2008-12-17 19:14:49 UTC
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 BCS 2008-12-17 19:19:52 UTC
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 anonymous4 2008-12-18 03:56:41 UTC
I think, arithmetic in D is the same as in C.
Comment 3 Walter Bright 2012-01-22 21:14:05 UTC
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.