Skip to content

Change Type::member to return a Result and rename it to try_member #194

Description

@MichaReiser

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").

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    internalAn internal refactor or improvement

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions