This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Suggestion re GCC's statement expression extension


Hi,

From the recent discussion of statement expressions, it seems that the
most significant use of these is to introduce named temporary
variables within an expression.

Why don't we introduce an explicit construct for this, something like:

__let__ int x = foo() __in__ (x * x).

which would be an expression that assigns foo() to x, and then yields
the value (x*x).  The name x should only be visible within the
__let__...__in__... expression, but the lifetime of the variable
should be determined just like the lifetime of any other (unnamed)
temporary introduced in an expression.

(Perhaps a more C-like syntax could be used, though.)

Ralph.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]