gracelang / language

Design of the Grace language and its libraries
GNU General Public License v2.0
6 stars 1 forks source link

Abstract (uninstantiable) classes (low priority) #148

Closed kjx closed 6 years ago

kjx commented 6 years ago

We can have abstract classes - in the Java sense - incomplete classes that should not be directly instantiated, but only via inheritance.

An annotation is abstract can permit the object (or class) to be instantiated only iff it is being called from an inherit or use clause from another object or class. In Grace it's trivially easy to get around (instead of abstractCollection write object { inherit abstractCollection } but perhaps it is something.

Still could have abstract on objects and classes (if we know how to annotate them :-).

method abstractCollection {
   object {
      is abstract
      method blah(_) blah(_) { } 
  }
}
kjx commented 6 years ago

Already in as issue #103.