Changes in src/initialization.txt [9cb8e88d:843054c2]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/initialization.txt
r9cb8e88d r843054c2 34 34 sure that resolved initializers for all declarations are being 35 35 generated. 36 37 38 ------39 40 More recent email: (I am quoted; Richard is the responder)41 > As far as I'm aware, the only way that I could currently get the correct42 > results from the unification engine is by feeding it an expression that43 > looks like "?=?( ((struct Y)x.y).a, 10 )", then picking out the pieces that44 > I need (namely the correct choice for a). Does this seem like a reasonable45 > approach to solve this problem?46 47 No, unfortunately. Initialization isn't being rewritten as assignment,48 so you shouldn't allow the particular selection of assignment49 operators that happen to be in scope (and which may include50 user-defined operators) to guide the type resolution.51 52 I don't think there is any way to rewrite an initializer as a single53 expression and have the resolver just do the right thing. I see the54 algorithm as:55 56 For each alternative interpretation of the designator:57 Construct an expression that casts the initializer to the type of58 the designator59 Construct an AlternativeFinder and use it to find the lowest cost60 interpretation of the expression61 Add this interpretation to a list of possibilities62 Go through the list of possibilities and pick the lowest cost63 64 As with many things in the resolver, it's conceptually simple but the65 implementation may be a bit of a pain. It fits in with functions like66 findSingleExpression, findIntegralExpression in Resolver.cc, although67 it will be significantly more complicated than any of the existing68 ones.69 70 71
Note: See TracChangeset
for help on using the changeset viewer.