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
Currently, DecodeResult relies on the convention that for each type there is a Decode<TypeName> function. It invokes the decode function only for the predefined types, not for custom-defined ones.
res:=DecodeResult[MyOk, MyError](buffer)
We need to be able to dynamically build/call the corresponding decode function for the specified type using reflection.
Approach 1: Obtain the full package name of the corresponding function. We could potentially derive it from the Type. However, we'll rely on the convention that the decode function is defined in the same package.
Approach 2: Include a Decode method as part of the interface, so there will be type checks, and each type will have a Decode method that can be called using reflection.
Declarations of
Option[T]
andResult[T, E]
value types can specify custom-defined types for T and E.Example:
Currently,
DecodeResult
relies on the convention that for each type there is aDecode<TypeName>
function. It invokes the decode function only for the predefined types, not for custom-defined ones.We need to be able to dynamically build/call the corresponding decode function for the specified type using reflection.
Approach 1: Obtain the full package name of the corresponding function. We could potentially derive it from the Type. However, we'll rely on the convention that the decode function is defined in the same package.
Approach 2: Include a
Decode
method as part of the interface, so there will be type checks, and each type will have aDecode
method that can be called using reflection.Related #62
The text was updated successfully, but these errors were encountered: