[Grace-core] Decisions from yesterday's phone conference

James Noble kjx at ecs.vuw.ac.nz
Wed Jun 22 17:53:06 PDT 2011


> 2.  We provisionally decided that we would include a private/public classification of method declarations in objects or classes....


>  Private methods could only be accessed via self or super.  Thus if m(...) is declared to be private, then self.m(...) and super.m(...) are legal, but o.m(...) will not be legal if o is not syntactically the self or super keywords.

and of course m(...) is OK

note to implementors: we talked about requiring an explicit self or super for calls to methods up or down the inheritance chain,
but haven't finalized that part of the design yet.  This is following AmbientTalk - see "Lexical Scope vs Object Scope" here
http://soft.vub.ac.be/amop/at/tutorial/multiparadigm

>  My preference is that everything is private unless provided with the annotation "public", but I don't believe we discussed that.

We didn't. I think this is another situation where two of our goals is in conflict.
 - avoid incantations
 - good code should be shorter
 - support best SE practice

the problem is that having private be the default is the right thing from an SE point of view,
but will require people to start declaring methods "public method" - which is (a bit of) an incantation

while having public the default needs less explanation but starts them off in bad style... 

One pragmatic argument is that because this really is enforced - people will learn to put "public" in at least where they need it
 or their programs won't run.

Another pragmatic argument is that then, programmers learn to write "public method" as an incantation by default, 
so everything is public anyway. 

one obviously Bad Idea is that methods are public by default, consts & var are private...

another Bad idea is that an InitialCapital is public, initial lowercase is private (from Go)

> We also did not discuss how to include this annotation for (methods generated implicitly by) instance variables.  One proposal might be to include the following set of options.
> 	var iv0: T0 := ...                        // both methods private
>         <readonly> var iv1: T1 := ...  // only the iv1() method is public
>         <writeonly> var iv2: T2 := ...  // only the iv2:=(...) method is public
>         <readwrite> var iv3: T3 := ... // both methods are public

so we may - or may not - want to do this.  

I find "readonly" and "writeonly" confusing - the variables are all read-write! 
The question is whether the reader & writer methods are public or not.
So readwrite should probably just be called "public".

Self v2 had annotations like public-private and private-public (written ^_ and _^, because public is ^ and private _ ) 
which I'd probably prefer.
UML uses -private; #protected; +public; ~package.

> Of course, we also haven't discussed how to even write annotations ... and we need to do that sometime soon.

yes we do, it's on the list of things we need to do.

> 3.  We are considering two possibilities for numeric types.

I may have another proposal again... 
(or perhaps it's the same as Andrew's proposal)

> ---------
> We also still need to discuss generics, particularly constrained generics.  We could talk about SelfType as well, though I am still hesitant to put that in the core of a language for novices (as opposed to an extended version).


I have an idea here (partly inspired by Ada :-)   basically to stratify classes and generic ...

which is also sitting in my messages-to-write queue

J


More information about the Grace-core mailing list