const, final, scope function parameters

Regan Heath regan at netmail.co.nz
Sun May 27 14:00:51 PDT 2007


Walter Bright Wrote:
> Regan Heath wrote:
> > Ahhh, I think I see what you're concerned about.  As in this example?
> > 
> > mutable int gx;
> > void foo(int y) {  //y is scope const final
> >   mutable int z;
> > }
> 
> Yes. Even I wouldn't use such a language :-(

I agree.

> > Why can't we apply 'scope const final' to function parameters only?
> 
> Because it knocks people for a loop - gives a bad first impression.

Really?  Have these people tried using it, in the beta itself?  Or have you just explained it to them?  I would hope that once someone actually uses it, it would come quite naturally.

The hope is that these automatic restrictions will prevent bad programming practices, assuming they do that it must mean these people like to use bad programming practices?  or maybe we're preventing things which aren't bad programming practices?  if so, what?

As this is going to be a 'beta' can we just give it a go anyway?  I mean, once people start using it we can get concrete examples of where it doesn't work, or is a hindrance, or whatever.

I know "having things work the way you'd expect them to" is something you want for D, but surely there are ingrained but 'bad' expectations which exist, those which we should really contradict in as definate a fashion as possible in order to evolve.

Regan Heath



More information about the Digitalmars-d mailing list