[Grace-core] Visibility of variables and constants in Objects
Kim Bruce
kim at cs.pomona.edu
Fri Jul 5 06:43:17 PDT 2013
Sent from my iPad
On Jul 5, 2013, at 3:33 PM, James Noble <kjx at ecs.vuw.ac.nz> wrote:
>>
>
> (BTW I thought of a use case for fields overriding methods - implementing an abstract field :-)
>
>
> type Point = {
> x -> Number
> y -> Number
> }
>
> class AbstractPoint.new -> Point {
> method x is abstract -> Number { }
> method y is abstract -> Number { }
> }
>
> class CartesianPoint -> Point {
> var x is public : Number
> var x is public : Number
> }
>
While you could do this, you could also just add new instance vbles x', y' and override x to be method x {x'} etc.
More information about the Grace-core
mailing list