bill@proxftl.UUCP (T. William Wells) (05/28/88)
I noticed a discussion that seems to be about declaring constants of other than the simple types. While I do not advocate adding them to the language (though I would not necessarily oppose adding them), I do have a suggestion for a syntax for them. '(' type-name '=' initializer ')' This should be considered as creating an anonymous variable of an appropriate type which is initialized according to the initializer and then used in the expression the constant is contained in. The existence and modifiability of the anonymous variable would be implementation dependent. For example, an expression of the form: typedef struct foo { int x, y; } foo; foo z, *p; z = (foo = {1,2}); might be compiled as if it were written: z.x = 1; z.y = 2; And p = &(foo = {1,2}); would require that the constant exist (so that p could point to it) but would not require that the constant be modifiable. Anybody got a better idea? Does anyone believe that the resulting grammer or semantics would be ambiguous?