Skip to content

proposal: constraints: add ReadOnlyChan and WriteOnlyChan #48366

Closed
@ianlancetaylor

Description

@ianlancetaylor

The currently accepted proposal for the constraints package (#45458) adds a constraint Chan. In #47319 (comment) @Merovius points out that does not support read-only and write-only channel types. This proposal is to add new constraints

type ReadOnlyChan[Elem any] interface { ~<-chan Elem }
type WriteOnlyChan[Elem any] interface { ~chan <- Elem }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions