Description
Similar to Type::try_call, try_iterate, try_bool, ..., member should be renamed to try_member and return Result.
- I don't think it should be
LookupResult: Instead, it should be a result specific to Type::member because we may want to preserve additional error information for better diagnostics that isn't relevant when doing other symbol lookups. But I might be wrong here
- I don't think
try_member should return a Symbol because it behaves slightly different from all other type methods in that it doesn't necessarily consider a possibly unbound symbol as an error (but it probably is one for most type checking code).
We could offer helper methods to easily convert a Result<Type, MemberError> to a Result<Type, LookupError> or Symbol (e.g. implement From for Result<Type, LookupError> so that the try operator "just works").
Description
Similar to
Type::try_call,try_iterate,try_bool, ...,membershould be renamed totry_memberand returnResult.LookupResult: Instead, it should be a result specific toType::memberbecause we may want to preserve additional error information for better diagnostics that isn't relevant when doing other symbol lookups. But I might be wrong heretry_membershould return aSymbolbecause it behaves slightly different from all other type methods in that it doesn't necessarily consider a possibly unbound symbol as an error (but it probably is one for most type checking code).We could offer helper methods to easily convert a
Result<Type, MemberError>to aResult<Type, LookupError>orSymbol(e.g. implementFromforResult<Type, LookupError>so that thetryoperator "just works").