[Grace-core] Edited Variable & Constant page

Michael Kölling M.Kolling at kent.ac.uk
Wed Nov 17 05:45:25 PST 2010


On 16 Nov 2010, at 07:21, James Noble wrote:

>> And then we can have private const x, readonly const x, etc. for the invariables.
> 
> so the keywords would be "field" and "const" - yep that could work.

Yes, I like that.

> the difficulty with "const" is, well
> readonly const x = HighlyVolatileMutableClass.new;   // urgh. How is this const?

I don't see this as a strong argument against it. There are two possible meanings of const (reference or object is const). The difference has to be understood by learners whatever it is called. In our case only the reference is const -- I don't think that naming it const detracts from the understanding. Naming it somethign different only because the object isn't certainly doesn't seem to make it clearer (just more obscure).

> another option, that may be unpopular, is that these things are all just "var" iables
> 
> var x = e   declares a fixed binding
> var x := e  declares a variable binding.

In my head, you're right: this is unpopular... :-)

mik



More information about the Grace-core mailing list