any news on const/invariant?

Derek Parnell derek at nomail.afraid.org
Mon Nov 26 23:31:05 PST 2007


On Mon, 26 Nov 2007 23:23:41 -0800, Nathan Reed wrote:

> Janice Caron wrote:
>> I guess it could change its own local copy of the pointer, but that
>> would just be a bug local to the function.
> 
> One which, I would think, should be caught by the type system.  However, 
> if there's no 'final', I guess this can't be done.
> 
> On the other hand, maybe the compiler should just emit a warning when a 
> passed-by-value parameter is written to.  If you really do want to 
> change your local copy of a parameter you can always copy it to a variable.
> 

I'm talking about having the compiler help catch coding mistakes at compile
time. In this case, the compiler can only know that it is a mistake to
(attempt to) modify the pointer if the coder tells it that the design
forbids that behaviour. Therefore we need to have form of syntax to help
the compiler help the coder.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
27/11/2007 6:29:07 PM



More information about the Digitalmars-d mailing list