context-free grammar

Jonathan M Davis jmdavisProg at gmx.com
Fri Mar 4 20:39:27 PST 2011


On Friday 04 March 2011 20:31:38 Walter Bright wrote:
> uri wrote:
> > Explain why (a*b) is lvalue in bearophile's second example.
> 
> Because the expression evaluates to a temporary, which is an lvalue.
> 
> > This is one of the weird things in D. The language is too complex. It
> > takes years to find out about the corner cases.
> 
> It's not a weird corner case at all. Temporaries can be used as lvalues (in
> C++ too).

Really? I thought that a temporary was pretty much _the_ classic example of an 
rvalue. If you can assign to temporaries, you can assign to most anything then, 
other than literals. Why on earth would assigning to temporaries be permitted? 
That just seems unnecessary and bug-prone.

- Jonathan M Davis


More information about the Digitalmars-d mailing list