You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The read-only APIs give us faster compilation by introducing new supertraits for the CaseClass and SealedTrait interfaces which save the cost of generating methods we are not going to use. We don't have "write-only" interfaces, but a similar approach could be used, at the expense of more complexity in the lifted interface hierarchy.
However, if Magnolia knew that one of these approaches was required, it could use the same interface, but simply implement the unused methods with ???.
There is a question about how it would determine this, but I would suggest checking whether final val readOnly = true or final val writeOnly = true exist in the derivation object; each should be typed as true.type, hence the use of final. (They could also be typed as Unit and their mere existence would be the application of that flag.)
The text was updated successfully, but these errors were encountered:
Interesting idea! How about a sealed trait of ReadOnly/WriteOnly/ReadWrite? With them being case objects it'll work too right? I can take a stab at this if you want?
The read-only APIs give us faster compilation by introducing new supertraits for the
CaseClass
andSealedTrait
interfaces which save the cost of generating methods we are not going to use. We don't have "write-only" interfaces, but a similar approach could be used, at the expense of more complexity in the lifted interface hierarchy.However, if Magnolia knew that one of these approaches was required, it could use the same interface, but simply implement the unused methods with
???
.There is a question about how it would determine this, but I would suggest checking whether
final val readOnly = true
orfinal val writeOnly = true
exist in the derivation object; each should be typed astrue.type
, hence the use offinal
. (They could also be typed asUnit
and their mere existence would be the application of that flag.)The text was updated successfully, but these errors were encountered: