opshin icon indicating copy to clipboard operation
opshin copied to clipboard

Proper instance and class methods

Open nielstron opened this issue 10 months ago • 0 comments

Is your feature request related to a problem? Please describe. Currently classes in OpShin do not support methods. It would be nice to support methods. Especially magic methods (__add__) would improve the situation of i.e. Fractions etc.

Describe the solution you'd like Users should be able to declare methods on PlutusData classes which will be dispatched to when called from OpShin code.

Describe alternatives you've considered None

Additional context Note that this might be more complex than it seems. In particular, the functions should be (C-Style) compiled and mapped somewhere global-statically, then called instead of the attribute accessed (one option). Note also that OpShin does currently not permit inheritance (and does not plan to) which should improve the situation.

Bug bounty: 2500 ADA

nielstron avatar Apr 07 '24 16:04 nielstron