On 11/18/2025 10:08 AM, Timur Tabi wrote:
> On Tue, 2025-11-18 at 22:04 +0900, Alexandre Courbot wrote:
>> On principle, I tend to agree. In practice, we will probably never have
>> more than these two variants, so we need to balance the benefit of a
>> trait against the overhead of defining it in the first place (there are
>> quite a few methods in there).
>>
>> Trait objects come with their own complications, i.e. you need to store
>> them on the heap if you need more than a short-lived reference - but in
>> our case the short-lived reference should be what we need anyway.
> 
> So I would prefer not to rewrite everything, especially since you did tell me 
> early on than an
> enum was the right approach.

If you see the example I provided, you can still keep the enum if you
implemented it with traits. The trait is on the inner object.

Thanks.

Reply via email to