maxrt101 / ff

Scripting language
MIT License
4 stars 0 forks source link

Classes and Instances (`class`, `new`) #19

Closed maxrt101 closed 1 year ago

maxrt101 commented 2 years ago

New types needed: ClassType - Class ClassInstanceType - ClassInstance

class File will be a Class ClassInstance will store a Ref to Class

New keywords needed: static pub

Example:

class File {
  handle: CFile;
  pub filename: string;

  read(size: uint): array -> {}

  static open(name: string): File -> { ... }
}
maxrt101 commented 2 years ago

Prototype Inheritance Will have base class as a field of ClassInstance If multiple inheritance will be a thing, a list of base classes will be stored

maxrt101 commented 1 year ago

Implementation: https://github.com/maxrt101/ff/tree/issue-19-class-support

maxrt101 commented 1 year ago

d6c3a43 - rev1

Done:

Todo:

maxrt101 commented 1 year ago

Merged