Skip to content

reflect: decide, document whether custom Type implementations are supported #32303

@bradfitz

Description

@bradfitz

Does the reflect package support users who implement Type themselves?

https://golang.org/pkg/reflect/#Type has unexported methods, but it's still possible to implement it by embedding a reflect.Type and using the normal (*rtype) type.

The documentation doesn't say that it's not allowed, but apparently people do it:

 https://godoc.org/gorgonia.org/tensor#Dtype

This apparently worked (enough? kinda?) at some point, and then we broke it, probably because we never imagined somebody would do this. That led to sending https://golang.org/cl/179338

This bug is to decide whether that's supported and to document. If it's supported, it needs tests.

/cc @ianlancetaylor @rsc @bcmills @randall77 @aclements @cherrymui

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    Status

    Triage Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions