Bypassing specialization for proper RO and R/W support #4
Replies: 2 comments
-
|
I should probably say here that my way of "bypassing" specialization isn't as concrete as I thought. If someone obtains a FileSystem using |
Beta Was this translation helpful? Give feedback.
-
|
In order to fix the above issue I thought of creating 2 separate So, I came up with another approach (hopefully without any loopholes). We keep our approach of having a single All that has now been implemented with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
On Jul 21, 2025, 11:17 AM GMT+0, @danielhenrymantilla wrote:
@Oakchris1955 I think there are other interesting ways to tackle this problem.
There are two approaches worth exploring here:
Option 1: downcast-to-
dynhelperimpl MaybeWrite for MyNonWriteableType {}as-needed.Then, on use site (
S : Read + Seek + MaybeWrite):Option 2: make
FileSystemitself generic over itsWrite-abilityand keep your two constructors, but producing types with either
Writability;and have all usages of
FileSystem<S>over a genericS: Read + Seekalso be generic over<W>;except the concrete cases requiring
Writability::ReadWriteknowledge, where you'd hard-code that param.There is even a way to do a hybrid approach of these two (so you never need to "hard-code
Writability::ReadWriteexcept at construction-site).Beta Was this translation helpful? Give feedback.
All reactions