Overriding functions in remixed types

#1

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> {

  @py(env='pythonenv')
  predict: ~

  @py(env='pythonenv')
  train: member function(dataset: ...) : ...

... other methods and fields
}

Would it be:

remix TypeA<T> mixes TypeB<T>
@py(env='pythonenv')
predict: ~
remix TypeA<T>
@py(env='pythonenv')
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: ...) : ... )
#2

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

#3

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

#4

I would think 2 should do the trick.

#5

So it would look like
Original:

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

Remix:

remix type A {
  function1: ~ js client
}
#6

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