Improve definition of multi-methods
0x706b opened this issue · comments
Currently, multi-methods are collected from @tsplus fluent
definitions, and overloads are ordered by collection order. In other words, they aren't ordered at all. Multi-methods should have their own distinct definition syntax that allows the definition of sort order.
Something like:
/**
* @tsplus multi-fluent A multi 0
*/
export function multi0<A, B>(self: A, b: B) {}
/**
* @tsplus multi-fluent A multi 1
*/
export function multi1<A, B>(self: A, b: B) {}
We could in theory consider fluent
as the first implementation (implicit index 0) and require any other definition to specify an index @tsplus fluent tag name 1
, similar work should be done with operators where overload selection is not yet implemented.
Additionally any duplicated tag (like two base fluent) should raise a diagnostic