[Types-sig] const (was: PyDL RFC 0.02)

skaller skaller@maxtal.com.au
Thu, 30 Dec 1999 03:05:37 +1100


Greg Stein wrote:

> > 'const', IMHO, in Paul's name based model, means the name
> > cannot be rebound:
> >
> >       const x = 1 # x is always bound to 1
> >
> > But:
> >
> >       const x = []
> >       x.append(1) # fine, x is still bound to the same list
> >
> > This does not require a readonly flag, it can be
> > enforced at compile time (in the absence of 'exec'
> > statements :-)
> 
> Please re-read Paul's posts. In the quoted section above, he says we need
> to say "that an object is not modifiable." 

	I know, but that is my point: it isn't consistent
with a model in which checking is applied to _names_:
we'd need to model access like in C/C++ with pointers.
This is pervasive, and it doesn't seem to me to sit well
with optional declarations. Declaring a name non-rebindable
on the other hand fits well with current semantics
(a function cannot rebind non-local names unless declared 'global')

-- 
John Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850