Overriding functions in remixed types


What’s the correct syntax to create a type in a separate package that overrides a single method on another type, but retains all the other fields and methods?

So if the type declaration of the type is the following and you want to overwrite the “predict” method:

type TypeA<T> mixes TypeB<T> {

  predict: ~

  train: member function(dataset: ...) : ...

... other methods and fields

Would it be:

remix TypeA<T> mixes TypeB<T>
predict: ~
remix TypeA<T>
predict: ~
remix TypeA
predict: ~ 

In summary, would you need the:

  1. mixes TypeB<T>
  2. the <T> in TypeA<T>
  3. the runtime annotation `@py(env=‘interpretable’)
  4. the predict function declaration (member function(dataset: ...) : ... )

I have a question that is very similar. Namely, when remixing a type, is overriding functions supported?


yes, but you must declare the function in the .c3typ file as well as providing the new function in the .js or .py


I would think 2 should do the trick.


So it would look like

type A mixes B {
  function1: member function() : boolean js client


remix type A {
  function1: ~ js client

Exactly (adding more text because of character limit :slight_smile: )