Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/initialization.txt

    r9cb8e88d r843054c2  
    3434sure that resolved initializers for all declarations are being
    3535generated.
    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 correct
    42 > results from the unification engine is by feeding it an expression that
    43 > looks like "?=?( ((struct Y)x.y).a, 10 )", then picking out the pieces that
    44 > I need (namely the correct choice for a). Does this seem like a reasonable
    45 > 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 assignment
    49 operators that happen to be in scope (and which may include
    50 user-defined operators) to guide the type resolution.
    51 
    52 I don't think there is any way to rewrite an initializer as a single
    53 expression and have the resolver just do the right thing. I see the
    54 algorithm as:
    55 
    56 For each alternative interpretation of the designator:
    57   Construct an expression that casts the initializer to the type of
    58     the designator
    59   Construct an AlternativeFinder and use it to find the lowest cost
    60     interpretation of the expression
    61   Add this interpretation to a list of possibilities
    62 Go through the list of possibilities and pick the lowest cost
    63 
    64 As with many things in the resolver, it's conceptually simple but the
    65 implementation may be a bit of a pain. It fits in with functions like
    66 findSingleExpression, findIntegralExpression in Resolver.cc, although
    67 it will be significantly more complicated than any of the existing
    68 ones.
    69 
    70 
    71 
Note: See TracChangeset for help on using the changeset viewer.