[Grace-core] Constructors

James Noble kjx at ecs.vuw.ac.nz
Fri Oct 29 03:51:49 PDT 2010


I had another look over this, and added a bit more to the wiki page.

I think that by renaming the constructors / initialisers / makers we can
make the code more graceful - but there are still quite a few issues
here to work out - particularly wrt how the type parameters work.

----


{{{
    init capacityDelta<T>(capacity: Num, capacityDelta: Num) = {
       elt = new Array[T](capacity)
    }

    init capacity<T>(capacity: Num) = capacityDelta(capacity, 0)

    init make<T>() = capacityDelta(10,04)

    var elt = Array[T].new(capacity)
}}}

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
  * But then how do constructor call other constructors? To which  
object are constructor
     calls (and self calls) sent?
  * how do the calls to "classes"/"factories" work with **type  
parameters**?


More information about the Grace-core mailing list