On Thu, 2008-03-27 at 15:45 -0400, Swaroop Sridhar wrote: > Jonathan S. Shapiro wrote: > > SHORT TERM > > > > The following are valid initializer expressions: > > > > 1. Literals > > 2. Application of +, -, *, /, OR, AND, IF, where the constituent > > expressions are initializer expressions. > > 3. SIZEOF > > 4. Constructing forms > > 5. Lambda forms. Note that these cannot be applied at initialization > > time because of the limitations of rule [2]. > > 6. Statically initialized symbols whose DEFINITION (not declaration) > > are lexically in scope (we say that such a symbol is "observably > > defined at initialization time") > > Does anybody see a problem with the short-term approach above that I may > > be failing to consider? > > The application of + - * / etc should be permitted only for applications > on primitive integer types right? Otherwise, the programmer can provide > an instance for the Arith class where these methods are satisfied > through side-effecting functions. Such an application should not be > permitted even though the arguments are initializer expressions.
I thought I had that covered by [2], but I got it wrong because [4] can be used to admit new cases. [2] should restrict the set of types over which the listed operations can be applied. I suspect that the allowed types should be integral types (including word), bool, char, string. I also suspect that there is a longer list of permitted operations that should be incorporated, but it's easy enough to expand this list as we discover them. shap _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
