Skip to content

feature: Mashal/Unmarshal having only a parametrized interface #563

Open

Description

@aalireza

Is your feature request related to a problem? Please describe.

I have interfaces like this:

type Scalar[T any] interface {
    Add(rhs Scalar[T]) T
}

I want to directly marshal and unmarshal having only the interface itself. If this interface wasn't parametrized, then I could have defined an encoder/decoder with a TagSet where I would add the concrete types of Scalar. I can't do that when the interface (and by extension, the concrete type that's implementing it) is parametrized as I have to fill out the concrete type's parameters at TagSet.Add time without knowing what they are.

Describe the solution you'd like
To directly marshal an unmarshal, having only the parametrized interface itself.

Describe alternatives you've considered
N/A

Additional context
N/A

Activity

  1. fxamacker commented on Jul 22, 2024

    @fxamacker
    Owner

    @aalireza Thanks for opening this issue. I am looking into it.

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions