Skip to content
This repository was archived by the owner on Sep 20, 2022. It is now read-only.
This repository was archived by the owner on Sep 20, 2022. It is now read-only.

type switch #9

Description

@glycerine

Can one type switch within the implementation of a generic function? something like this might be reasonable:

func add[T](a, b T) T {
  switch T { // equivalent to switch a.(type)
       case float64:
            return math.Round(a + b)
        case int64:
           return a+b
   }
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions