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

Defining multiple interfaces for one type

Open ReubenJ opened this issue 9 months ago • 3 comments

The docs for @implements mention the ability to define a type as inheriting from multiple interfaces by supplying a vector of interfaces, but it appear that the macro only handles the cases: Interface{:option} or plain, single Interface.

Am I missing something?

The docstring mentioning it:

https://github.com/rafaqz/Interfaces.jl/blob/b6191a05e35ac25cd378b86984f31676810e7898/src/implements.jl#L53-L54

The logic for handling the interface argument to the macro:

https://github.com/rafaqz/Interfaces.jl/blob/b6191a05e35ac25cd378b86984f31676810e7898/src/implements.jl#L70-L80

Thanks for your work on this package! Really appreciate the thought going into it.

ReubenJ avatar Feb 22 '25 23:02 ReubenJ

I think the doc is just old and wrong. You can call @implements for multiple interfaces with the same object.

rafaqz avatar Feb 23 '25 10:02 rafaqz

Got it. Seems like an easy thing to support, right? I could make a quick PR for it if you like.

ReubenJ avatar Feb 24 '25 09:02 ReubenJ

I may be cleaner just to do separate calls? I'm ok with needing one line per interface.

rafaqz avatar Feb 24 '25 10:02 rafaqz