gracelang / minigrace

Self-hosting compiler for the Grace programming language
39 stars 22 forks source link

inherited methods cannot be overridden #241

Open apblack opened 7 years ago

apblack commented 7 years ago

When an object inherits from a parent defined in another module, the methods of that parent cannot be overridden.

This happens because the parent's methods are added to the object's symbol table as methods, rather than as inherited methods. When the overriding definition is encountered, it is rejected as a duplicate definition.

An example demonstrating the problem is the beginningStudent dialect, which inherits from minispec.methods. This parent defines list, list(_), etc. The beginningStudent dialect wants to override these methods.

The current workaround is to exclude these methods from the inheritance. This isn't bad, but ought to be unnecessary.