assignment to this

Regan Heath regan at netmail.co.nz
Wed Jul 18 01:01:21 PDT 2007


Jarrett Billingsley wrote:
> "Ender KaShae" <astrothayne at gmail.com> wrote in message 
> news:f7j521$1dnc$1 at digitalmars.com...
>> since my idea of assigning to this fell through I am wondering if there is 
>> another way that I can give an immutable type opPostInc, opAddAssign, etc. 
>> without altering all references to it.  any ideas?
> 
> Even if assigning to this did work, it wouldn't solve that problem.  'this' 
> is just another local parameter to a member function. 

Which is probably exactly why it doesn't work.

I agree with the OP tho, it should either work as you'd expect or error.

In other words:
  - 'this' could be made 'ref'
  - 'this' could be made 'final'

Regan


More information about the Digitalmars-d-learn mailing list