Properties, opIndex, and expression rewriting.

Sergey Gromov snake.scaly at gmail.com
Tue Aug 11 13:52:35 PDT 2009


Tue, 11 Aug 2009 03:19:42 -0400, Chad J wrote:

> So, Walter, how about some expression rewriting logic to solve some of
> the problems with properties, opIndex, and related lvalueness stuff?
> 
> (I refer to the expression rewriting in the Wiki4D article on
> properties:
> http://prowiki.org/wiki4d/wiki.cgi?DocComments/Property#Semantic)
> 
> Syntax can be broached later.
> 
> I've also attached some D-like pseudocode of what I think such an
> expression rewriting algorithm would look like (propertyrewrite.d).  The
> other file is a potential test-case.  I used it to figure out what a
> trace of the algorithm might look like, and designed it accordingly.  If
> it can wait a few weeks, I might try to put it into dmd and write a
> patch.  I'll only do it if there's interest though.

It would be nice if you made a patch.  This way we could see for
ourselves if it worked and vote for it.

I've noticed an optimization which reduces number of calls to a getter.
I think you shouldn't do that: you should call getter as many times as
the expression suggests, and leave the rest to the optimizer.



More information about the Digitalmars-d mailing list