DMD 0.177 release [Length in slice expressions]

Bill Baxter dnewsgroup at billbaxter.com
Sun Dec 24 16:13:48 PST 2006


Andrei Alexandrescu (See Website For Email) wrote:
> A simpler grammar would have been to simply allow:
> 
> UnaryExpression:
>     PostfixExpression
>     & UnaryExpression
>     ... etc. etc. ...
>     $ PostfixExpression
> 
> But this would have been ambiguous. If the compiler sees "$-1", then the 
> bad grammar says that's a unary use of $ because -1 is a 
> PostfixExpression. But that's not what we wanted! We wanted $ to be 
> nullary. That's why I needed to put all the cases in UnaryExpression.

Wouldn't that ambiguity be fixed by making $ a postfix unary operator 
instead?  Or would that just introduce different ambiguities?

--bb



More information about the Digitalmars-d-announce mailing list