[m-rev.] for review: self rval

Tyson Dowd trd at cs.mu.OZ.AU
Fri Jun 22 02:15:38 AEST 2001


On 21-Jun-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> On Thu, Jun 21, 2001 at 11:39:42AM +1000, Fergus Henderson wrote:
> > On 21-Jun-2001, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> > > +++ compiler/mlds.m	2001/06/20 14:22:42
> > > @@ -1254,8 +1254,13 @@
> > >  
> > >  	;	binop(binary_op, mlds__rval, mlds__rval)
> > >  
> > > -	;	mem_addr(mlds__lval).
> > > +	;	mem_addr(mlds__lval)
> > >  		% The address of a variable, etc.
> > > +
> > > +	;	self.
> > > +		% The equivalent of the this pointer in C++.  Note that
> > > +		% this rval is valid iff we are targetting an object
> > > +		% oriented backend.
> > 
> > I suggest s/this/`this'.
> > Also the rval is only valid inside instance methods (i.e. functions
> > which are class members and which have the `per_instance' flag set).
> > 
> > > --- compiler/mlds_to_csharp.m	2001/06/08 09:13:41	1.5
> > > +write_csharp_rval(self) -->
> > > +	{ sorry(this_file, "self rval") }.
> > 
> > > Index: compiler/mlds_to_java.m
> > > +output_rval(self) -->
> > > +	{ unexpected(this_file, "output_rval: self not supported") }.
> > 
> > Why not just output `this' in these two cases?
> > 
> I believe the only rval we are allowed to pass a piece of csharp or mcpp
> code is a variable, thus the error message.  I wasn't sure what the java
> backend used for its keyword, so I left it out.

The rvals here are *inside* the MC++ code, and could be arbitrary pieces
of code.  We actually generate all sorts of nasty things (nested
functions for example) inside MC++ so it could (one day) pop up.  

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list