BinaryTraits.jl icon indicating copy to clipboard operation
BinaryTraits.jl copied to clipboard

RFC: Allow multiple traits in one interface

Open KlausC opened this issue 4 years ago • 3 comments

It should be possible to define interfaces, which require more than one interface type. Example with proposal for syntax:

@trait ProblemDescription prefix Is,IsNot
@trait Solve
@implement Tuple{IsProblemDescription,CanSolve} by solve(_2, _1, general_parameters)

KlausC avatar Apr 15 '20 15:04 KlausC

Love this idea. The syntax shouldn't require Tuple{} construct though?

@implement IsProblemDescription,CanSolve by solve(_2, _1, general_parameters)

tk3369 avatar Apr 17 '20 06:04 tk3369

Agreed. Your syntax looks cleaner. I was actually thinking of the key type of BinaryTraits.interface_map and the value type of traits_map. ( Tuple{A,B} isa Datatype). But that is independent of the user syntax.

KlausC avatar Apr 17 '20 10:04 KlausC

This feature is a generalization of what was proposed from #29

tk3369 avatar Apr 20 '20 07:04 tk3369