[Grace-core] Constructors

Kim Bruce kim at cs.pomona.edu
Fri Oct 29 15:40:57 PDT 2010


On Oct 29, 2010, at 3:51 AM, James Noble wrote:

> 
> 
> So a few suggested changes / issues:
> * if we're going to call constructors / initialisers with anything like a normal send
>    then they can go to some object, basically the name of the type. So the constructors
>    don't need to encode the name of the type

I'd rather NOT call them with a normal send, because that leads to the problems below.

> * But then how do constructor call other constructors? To which object are constructor
>    calls (and self calls) sent?

In "new Capacity(...)", the "new" allocates the space, while the constructor body initializes the object.  This makes calls of superconstructors easy, as we just call them by name (without the "new") as I wrote in my code.  If we had to resort to calling them the same way as methods then it would somehow have to know when to allocate space and when not to.

Moreover this has the advantage of working the way that other languages they are familiar with work.

> * how do the calls to "classes"/"factories" work with **type parameters**?

Just the way that I (and you) wrote them.  Put them in pointy brackets.

Am I missing something?

	Kim
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core



More information about the Grace-core mailing list