[Grace-core] Constructors

Kim Bruce kim at cs.pomona.edu
Wed Oct 27 23:23:50 PDT 2010


James wrote in comments on the ArrayListClass in Grace:

"I am concerned about the make*CD names. If we find ourselves doing that a lot, then, well, that's not very graceful."

My response:

We decided to outlaw overloading, presumably for constructors as well as for methods.  If that is the case then if we want to allow multiple constructors in a class we either have to be able to give them different names or use default parameters (which, while less flexible, handles all of the constructors of the ArrayListClass).

Do you see any other alternatives?  ... and if not, would you rather suffer with multiple names of constructors or admit overloading (or did I totally misunderstand your comment?).

We could add a while loop, but I have a slight preference for "loop" with exits (and I can live with "if (...) then exit" rather than "exit if ..." even though I believe the latter has the advantage of making the exits more visible.

I welcome a discussion on inner classes.  I worry about going all the way to family polymorphism here (even though I have my own statically typed proposal for such a system).

Kim




More information about the Grace-core mailing list