# Polymorphic methods in enums

**URL:** <https://forums.swift.org/t/polymorphic-methods-in-enums/15093>\
**Category:** Pitches\
**Created:** [August 8, 2018, 1:13pm UTC](https://forums.swift.org/t/polymorphic-methods-in-enums/15093 "2018-08-08T13:13:57Z")\
**Posts on this page:** 1\
**Page:** 3

<div class="post-metadata">

**Author:** ![dwaite](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dwaite/32/1200_2.png) [@dwaite](https://forums.swift.org/u/dwaite)\
**Post date:** [August 20, 2018, 9:00pm UTC](https://forums.swift.org/t/polymorphic-methods-in-enums/15093/41 "2018-08-20T21:00:39Z")

</div>

> [@hlovatt](#):
>
> Most of the JVM languages, Java/Scala/Kotlin, allow this. It is a feature I mis from these languages. In these languages each case of the enum is a seperate type with its own dispatch table.

Yeah, this is the big difference, as each case in an enum in Swift is part of the same value type.

> [@](#):
>
> You can mimic this behavior in Swift with a protocol for the enum and a struct implementing the protocol for each case but then you can’t then stop people adding new cases.

Yeah, I think you would need to have the compiler effectively synthesize the switch statement, else you need to emulate (or add a new language type for) the Java-style reference type enums.

Chances are you would not want to use extension for this, as other conditional conformances/method additions won't work.

[Previous page](https://forums.swift.org/t/polymorphic-methods-in-enums/15093.md?page=2)
